From cd19a7d7a07e76c6c8221a48d687816434662659 Mon Sep 17 00:00:00 2001 From: gnxlxnxx Date: Thu, 4 Jan 2024 22:49:20 +0100 Subject: [PATCH] ................. --- components/showcase_component/showcase_component.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/components/showcase_component/showcase_component.h b/components/showcase_component/showcase_component.h index d9a17b9..ba7ee3e 100644 --- a/components/showcase_component/showcase_component.h +++ b/components/showcase_component/showcase_component.h @@ -17,13 +17,18 @@ static const char *TAG = "showcase_component.component"; class ShowcaseComponent : public i2c::I2CDevice, public Component, public EntityBase { public: - State s_; - float b_upper_ = 1.0; - float b_lower_ = 1.0; + State s_{Off}; + float b_upper_{1.0}; + float b_lower_{1.0}; void turn_on(); void turn_off(); + void publish_state(){ this->remote_values_callback_.call(); } + + void add_new_remote_values_callback(std::function &&send_callback) { + this->remote_values_callback_.add(std::move(send_callback)); + } void setup() override; void loop() override; @@ -76,6 +81,8 @@ class ShowcaseComponent : public i2c::I2CDevice, public Component, public Entity this->lower_->set_level(bright); } protected: + CallbackManager remote_values_callback_{}; + output::FloatOutput *upper_; output::FloatOutput *lower_; /* monochromatic::MonochromaticLightOutput *upper_; */