[lvgl] Number saves value on interactive change (#12315)

This commit is contained in:
Clyde Stubbs
2025-12-07 01:49:15 +11:00
committed by Jonathan Swoboda
parent fb7800a22f
commit b6336f9e63

View File

@@ -29,15 +29,18 @@ class LVGLNumber : public number::Number, public Component {
this->publish_state(value);
}
void on_value() { this->publish_state(this->value_lambda_()); }
void on_value() { this->publish_(this->value_lambda_()); }
protected:
void control(float value) override {
this->control_lambda_(value);
void publish_(float value) {
this->publish_state(value);
if (this->restore_)
this->pref_.save(&value);
}
void control(float value) override {
this->control_lambda_(value);
this->publish_(value);
}
std::function<void(float)> control_lambda_;
std::function<float()> value_lambda_;
lv_event_code_t event_;