mirror of
https://github.com/esphome/esphome.git
synced 2026-05-27 20:53:46 +08:00
[lvgl] Number saves value on interactive change (#12315)
This commit is contained in:
committed by
Jonathan Swoboda
parent
fb7800a22f
commit
b6336f9e63
@@ -29,15 +29,18 @@ class LVGLNumber : public number::Number, public Component {
|
|||||||
this->publish_state(value);
|
this->publish_state(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_value() { this->publish_state(this->value_lambda_()); }
|
void on_value() { this->publish_(this->value_lambda_()); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void control(float value) override {
|
void publish_(float value) {
|
||||||
this->control_lambda_(value);
|
|
||||||
this->publish_state(value);
|
this->publish_state(value);
|
||||||
if (this->restore_)
|
if (this->restore_)
|
||||||
this->pref_.save(&value);
|
this->pref_.save(&value);
|
||||||
}
|
}
|
||||||
|
void control(float value) override {
|
||||||
|
this->control_lambda_(value);
|
||||||
|
this->publish_(value);
|
||||||
|
}
|
||||||
std::function<void(float)> control_lambda_;
|
std::function<void(float)> control_lambda_;
|
||||||
std::function<float()> value_lambda_;
|
std::function<float()> value_lambda_;
|
||||||
lv_event_code_t event_;
|
lv_event_code_t event_;
|
||||||
|
|||||||
Reference in New Issue
Block a user