diff --git a/components/wordclock/wordclock.h b/components/wordclock/wordclock.h index 4973d6e..0530e4d 100644 --- a/components/wordclock/wordclock.h +++ b/components/wordclock/wordclock.h @@ -83,6 +83,13 @@ public: } bool get_effect_active() { return this->effect_active; } void set_effect_active(bool x) { this->effect_active = x; } + + bool get_effect_width() { return this->effect_width; } + void set_effect_width(bool x) { this->effect_width = x; } + + bool get_effect_speed() { return this->effect_speed; } + void set_effect_speed(bool x) { this->effect_speed = x; } + void set_on_color(Color on_color) { this->on_color = on_color; } @@ -147,11 +154,12 @@ protected: uint32_t current_position{0}; bool effect_active{true}; + uint32_t effect_speed{12}; + uint16_t effect_width{50}; 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); - // Utils int8_t find_hour(uint8_t target_value); int8_t find_minute(uint8_t target_value); diff --git a/devlog.md b/devlog.md new file mode 100644 index 0000000..2a687de --- /dev/null +++ b/devlog.md @@ -0,0 +1,9 @@ +# Wordclock Development Log + + +## Feature "make speed and width of rainbow effect user-configurable" [2023-06-10 17:13] + +[17:16] Step - add attributes, getters, and setters for effect-speed and -width. + - [x] add attr/funcs to header file. + - [x] add inputs to yaml. + - \ No newline at end of file diff --git a/susannes_wordclock_esp32.yaml b/susannes_wordclock_esp32.yaml index 11f029f..38987ce 100644 --- a/susannes_wordclock_esp32.yaml +++ b/susannes_wordclock_esp32.yaml @@ -140,6 +140,35 @@ number: min_value: 0 max_value: 255 step: 1 + - platform: template + name: "6 Rainbow Speed" + optimistic: true + restore_value: true + initial_value: 12 + on_value: + - lambda: |- + id(wordclock_1)->set_effect_speed(x); + set_action: + - lambda: |- + id(wordclock_1)->set_effect_speed(x); + min_value: 1 + max_value: 4096 + step: 1 + - platform: template + name: "7 Rainbow Width" + optimistic: true + restore_value: true + initial_value: 50 + on_value: + - lambda: |- + id(wordclock_1)->set_effect_width(x); + set_action: + - lambda: |- + id(wordclock_1)->set_effect_width(x); + min_value: 1 + max_value: 65535 + step: 1 + # select: # - platform: template # name: "Rainbow ON/OFF"