mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 03:28:41 +00:00
[core] Implement Global Controller Registry to reduce RAM usage (#11772)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "select.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/controller_registry.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include <cstring>
|
||||
|
||||
@@ -33,6 +35,9 @@ void Select::publish_state(size_t index) {
|
||||
ESP_LOGD(TAG, "'%s': Sending state %s (index %zu)", this->get_name().c_str(), option, index);
|
||||
// Callback signature requires std::string, create temporary for compatibility
|
||||
this->state_callback_.call(std::string(option), index);
|
||||
#if defined(USE_SELECT) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_select_update(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *Select::current_option() const { return this->has_state() ? this->option_at(this->active_index_) : ""; }
|
||||
|
||||
Reference in New Issue
Block a user