feat(effect): add attributes, getters, and setters for effect-speed and -width
This commit is contained in:
parent
47f31301dd
commit
c54ff63f89
3 changed files with 47 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
9
devlog.md
Normal file
9
devlog.md
Normal file
|
|
@ -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.
|
||||
-
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue