diff --git a/components/wordclock/wordclock.cpp b/components/wordclock/wordclock.cpp index 6418759..68a23d8 100644 --- a/components/wordclock/wordclock.cpp +++ b/components/wordclock/wordclock.cpp @@ -114,10 +114,15 @@ Color Wordclock::get_next_color_base_(uint32_t position, uint32_t speed, uint16_ } Color Wordclock::get_next_color(uint32_t position, const Color ¤t_color) { + if (this->effect_active) { uint32_t speed_ = 3; uint16_t width_ = 100; // Original width_ = 50 return get_next_color_base_(position, speed_, width_, current_color); } + else { + return Color(this->on_color); + } +} int8_t Wordclock::find_hour(uint8_t target_value) { std::vector *elements = this->hours; diff --git a/components/wordclock/wordclock.h b/components/wordclock/wordclock.h index 563770e..54af2ef 100644 --- a/components/wordclock/wordclock.h +++ b/components/wordclock/wordclock.h @@ -81,6 +81,8 @@ public: void set_brightness(uint8_t brightness) { this->brightness = brightness; } + bool get_effect_active() { return this->effect_active; } + void set_effect_active(bool x) { this->effect_active = x; } void set_on_color(Color on_color) { this->on_color = on_color; } @@ -144,6 +146,7 @@ protected: std::vector *previous_segments; uint32_t current_position{0}; + bool effect_active{true}; Color get_next_color_base_(uint32_t position, uint32_t speed, uint16_t width, const Color ¤t_color); Color get_next_color(uint32_t position, const Color ¤t_color);