1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +00:00

Reduce entity memory usage by eliminating field shadowing and bit-packing (#9076)

This commit is contained in:
J. Nick Koston
2025-06-14 22:21:55 -05:00
committed by GitHub
parent a1e4143600
commit 4305c44440
25 changed files with 258 additions and 86 deletions

View File

@@ -7,7 +7,7 @@ namespace number {
static const char *const TAG = "number";
void Number::publish_state(float state) {
this->has_state_ = true;
this->set_has_state(true);
this->state = state;
ESP_LOGD(TAG, "'%s': Sending state %f", this->get_name().c_str(), state);
this->state_callback_.call(state);

View File

@@ -48,9 +48,6 @@ class Number : public EntityBase {
NumberTraits traits;
/// Return whether this number has gotten a full state yet.
bool has_state() const { return has_state_; }
protected:
friend class NumberCall;
@@ -63,7 +60,6 @@ class Number : public EntityBase {
virtual void control(float value) = 0;
CallbackManager<void(float)> state_callback_;
bool has_state_{false};
};
} // namespace number