diff --git a/components/xiaomi_bslamp2/light/automation.h b/components/xiaomi_bslamp2/light/automation.h index e1c7832..6499d11 100644 --- a/components/xiaomi_bslamp2/light/automation.h +++ b/components/xiaomi_bslamp2/light/automation.h @@ -29,7 +29,7 @@ class BrightnessTrigger : public Trigger { } protected: - float last_brightness_ = -1.0f; + float last_brightness_{-1.0f}; }; template class DiscoAction : public Action { diff --git a/components/xiaomi_bslamp2/light/light_transition.h b/components/xiaomi_bslamp2/light/light_transition.h index 62c788a..70ef462 100644 --- a/components/xiaomi_bslamp2/light/light_transition.h +++ b/components/xiaomi_bslamp2/light/light_transition.h @@ -20,13 +20,8 @@ class XiaomiBslamp2LightTransition : public light::LightTransition { light::LightTransition(name), light_(light) { } - // TODO deprecate or compile for 2018.8.* only. - bool is_finished() { - return is_completed(); - } - bool is_completed() override { - return force_finish_ || get_progress_() >= 1.0f; + return force_completed_ || get_progress_() >= 1.0f; } void start() override { @@ -60,9 +55,9 @@ class XiaomiBslamp2LightTransition : public light::LightTransition { // transitions at the low levels as used for the night light. if (end_->light_mode == LIGHT_MODE_NIGHT && start_->light_mode == LIGHT_MODE_NIGHT) { light_->set_state(end_); - force_finish_ = true; + force_completed_ = true; } - // Otherwise perform a standard transformation. + // Otherwise perform a standard transition. else { auto smoothed = smoothed_progress_(get_progress_()); light_->set_rgbw( @@ -75,7 +70,7 @@ class XiaomiBslamp2LightTransition : public light::LightTransition { } } - if (is_finished()) { + if (is_completed()) { light_->set_light_mode(end_->light_mode); if (end_->light_mode == LIGHT_MODE_OFF) { light_->turn_off(); @@ -89,7 +84,7 @@ class XiaomiBslamp2LightTransition : public light::LightTransition { protected: LightHAL *light_; - bool force_finish_{false}; + bool force_completed_{false}; GPIOOutputValues *start_ = new GPIOOutputValues(); ColorHandler *end_ = new ColorHandlerChain(); diff --git a/components/xiaomi_bslamp2/light/presets.h b/components/xiaomi_bslamp2/light/presets.h index f42c3d4..0abc6cd 100644 --- a/components/xiaomi_bslamp2/light/presets.h +++ b/components/xiaomi_bslamp2/light/presets.h @@ -47,13 +47,13 @@ class Preset : public Component { protected: light::LightState *light_state_; - optional transition_length_; - optional brightness_; - optional red_; - optional green_; - optional blue_; - optional color_temperature_; - optional effect_; + optional transition_length_{}; + optional brightness_{}; + optional red_{}; + optional green_{}; + optional blue_{}; + optional color_temperature_{}; + optional effect_{}; }; class PresetGroup {