mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 13:08:41 +00:00
[core] Implement Global Controller Registry to reduce RAM usage (#11772)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "text.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/controller_registry.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
@@ -16,6 +18,9 @@ void Text::publish_state(const std::string &state) {
|
||||
ESP_LOGD(TAG, "'%s': Sending state %s", this->get_name().c_str(), state.c_str());
|
||||
}
|
||||
this->state_callback_.call(state);
|
||||
#if defined(USE_TEXT) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_text_update(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Text::add_on_state_callback(std::function<void(std::string)> &&callback) {
|
||||
|
||||
Reference in New Issue
Block a user