|
@ -57,9 +57,11 @@ public: |
|
|
GPIOOutputs *delegate; |
|
|
GPIOOutputs *delegate; |
|
|
if (transition_handler_->set_light_color_values(values)) { |
|
|
if (transition_handler_->set_light_color_values(values)) { |
|
|
delegate = transition_handler_; |
|
|
delegate = transition_handler_; |
|
|
|
|
|
state_callback_.call(transition_handler_->get_end_values()); |
|
|
} else { |
|
|
} else { |
|
|
instant_handler_->set_light_color_values(values); |
|
|
instant_handler_->set_light_color_values(values); |
|
|
delegate = instant_handler_; |
|
|
delegate = instant_handler_; |
|
|
|
|
|
state_callback_.call(values); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Note: one might think that it is more logical to turn on the LED |
|
|
// Note: one might think that it is more logical to turn on the LED |
|
@ -80,14 +82,12 @@ public: |
|
|
|
|
|
|
|
|
if (values.get_state() == 0) |
|
|
if (values.get_state() == 0) |
|
|
light_->turn_off(); |
|
|
light_->turn_off(); |
|
|
|
|
|
|
|
|
state_callback_.call(values); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected: |
|
|
protected: |
|
|
LightHAL *light_; |
|
|
LightHAL *light_; |
|
|
GPIOOutputs *transition_handler_; |
|
|
|
|
|
GPIOOutputs *instant_handler_ = new ColorInstantHandler(); |
|
|
|
|
|
|
|
|
ColorTransitionHandler *transition_handler_; |
|
|
|
|
|
ColorInstantHandler *instant_handler_ = new ColorInstantHandler(); |
|
|
CallbackManager<void(light::LightColorValues)> state_callback_{}; |
|
|
CallbackManager<void(light::LightColorValues)> state_callback_{}; |
|
|
|
|
|
|
|
|
friend class YeelightBS2LightState; |
|
|
friend class YeelightBS2LightState; |
|
|