From 6e6d39cfe485b24a3435ee9714e81eda2ce08fa4 Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Fri, 21 Apr 2023 14:47:33 +0200 Subject: [PATCH] remove text_color --- README copy.md | 78 +------------------------------------- README.md | 9 ----- components/ehmtx/EHMTX.cpp | 7 ---- components/ehmtx/EHMTX.h | 2 - 4 files changed, 1 insertion(+), 95 deletions(-) diff --git a/README copy.md b/README copy.md index b9e83e0..f5510f9 100644 --- a/README copy.md +++ b/README copy.md @@ -381,70 +381,6 @@ sensor: --- -#### Set (alarm/clock/gauge/text/today/weekday) color action - -Sets the color of the selected element - -##### Lambda set text color - -```yaml - lamda: - id(rgb8x32)->set_text_color(200,45,12); -``` - -##### Action for set text color - -You have to use use id of your ehmtx component, e.g. `rgb8x32` - -```yaml - - ehmtx.***.color: - id: rgb8x32 - red: !lambda return r; - green: !lambda return g; - blue: !lambda return b; -``` - -valid elements: - -- `ehmtx.alarm.color:` -- `ehmtx.clock.color:` -- `ehmtx.gauge.color:` -- `ehmtx.text.color:` -- `ehmtx.today.color:` -- `ehmtx.weekday.color:` -- ```red, green, blue```: the color components (`0..255`) *(default = `80`)* - ---- - -#### Set screen color action - -Sets the color of the **active** screen in the queue, so it's best to use it directly after add_screen. - -##### Lambda for set_screen - -```yaml - lamda: - id(rgb8x32)->set_screen_color("sun",200,45,12); -``` - -##### Action for set_screen - -You have to use use id of your ehmtx component, e.g. `rgb8x32` - -```yaml - - ehmtx.screen.color: - id: rgb8x32 - icon_name: sun - red: !lambda return r; - green: !lambda return g; - blue: !lambda return b; -``` - -- ```icon_name```: name of the actual icon/screen -- ```red, green, blue```: the color components (`0..255`) _(default = `80`)_ - ---- - ##### Show date You can dynamically enable or disable the display of the date see parameter `show_date`. @@ -506,7 +442,6 @@ Experienced programmers can use this public methods: void set_gauge_off(); void set_gauge_value(int v); // valid: 0 - 100 int because of register_service void set_gauge_color(int r, int g, int b); - void set_text_color(int r, int g, int b); void set_clock_color(int r, int g, int b); void set_today_color(int r, int g, int b); void set_weekday_color(int r, int g, int b); @@ -567,16 +502,6 @@ ehmtx: ESP_LOGI("TriggerTest","Text: %s",y.c_str()); ``` -##### Change the text color like crazy - -```yaml -ehmtx: - .... - on_next_screen: - lambda: |- - id(rgb8x32)->set_text_color(rand() % 255, rand() % 255, rand() % 255); -``` - ##### Send an event to Home Assistant To send data back to home assistant you can use events. @@ -843,8 +768,7 @@ These services are the same as the local services, so you can adapt the document |`set_gauge_value`| {"percent"}| |`set_gauge_off`|*none*| |`set_alarm_color`| {"r", "g", "b"}| - |`set_text_color` | {"r", "g", "b"}| - |`set_clock_color`| {"r", "g", "b"}| + |`set_clock_color`| {"r", "g", "b"}| |`set_today_color`| {"r", "g", "b"}| |`set_gauge_color`| {"r", "g", "b"}| |`set_weekday_color` |{"r", "g", "b"}| diff --git a/README.md b/README.md index fc4e65c..98bdc21 100644 --- a/README.md +++ b/README.md @@ -575,15 +575,6 @@ sensor: #### Set (alarm/clock/gauge/text/today/weekday) color action -Sets the default color of the selected element - -##### Lambda set text color - -```yaml - lamda: - id(rgb8x32)->set_text_color(200,45,12); -``` - ##### Force screen Force the selected [icon_screen](#icon-screen) ```icon_name``` to be displayed next. Afterwards the loop is continuing from this screen. e.g. helpfull for alarms. Or after an update of the value/text. diff --git a/components/ehmtx/EHMTX.cpp b/components/ehmtx/EHMTX.cpp index 645dad2..dcc7d3d 100644 --- a/components/ehmtx/EHMTX.cpp +++ b/components/ehmtx/EHMTX.cpp @@ -81,12 +81,6 @@ namespace esphome ESP_LOGD(TAG, "default clock color r: %d g: %d b: %d", r, g, b); } - void EHMTX::set_text_color(int r, int g, int b) - { - this->text_color = Color((uint8_t)r & 248, (uint8_t)g & 252, (uint8_t)b & 248); - ESP_LOGD(TAG, "default text color r: %d g: %d b: %d", r, g, b); - } - bool EHMTX::string_has_ending(std::string const &fullString, std::string const &ending) { if (fullString.length() >= ending.length()) @@ -172,7 +166,6 @@ namespace esphome register_service(&EHMTX::show_alarm, "show_alarm", {"r", "g", "b","s"}); register_service(&EHMTX::show_indicator, "show_indicator", {"r", "g", "b","s"}); - register_service(&EHMTX::set_text_color, "text_color", {"r", "g", "b"}); register_service(&EHMTX::set_clock_color, "clock_color", {"r", "g", "b"}); register_service(&EHMTX::set_today_color, "today_color", {"r", "g", "b"}); register_service(&EHMTX::set_weekday_color, "weekday_color", {"r", "g", "b"}); diff --git a/components/ehmtx/EHMTX.h b/components/ehmtx/EHMTX.h index 2b03cbe..fb0033c 100644 --- a/components/ehmtx/EHMTX.h +++ b/components/ehmtx/EHMTX.h @@ -126,7 +126,6 @@ namespace esphome void set_time_format(std::string s); void set_date_format(std::string s); void show_indicator(int r=C_RED, int g=C_GREEN, int b=C_BLUE,int s=3); - void set_text_color(int r, int g, int b); void set_clock_color(int r=C_RED, int g=C_GREEN, int b=C_BLUE); void set_today_color(int r, int g, int b); void set_weekday_color(int r, int g, int b); @@ -189,7 +188,6 @@ namespace esphome bool del_slot(uint8_t _icon); void hold_slot(uint8_t _sec); void set_text(std::string text, uint8_t icon, uint16_t pixel, uint16_t et, uint16_t st); - void set_text_color(uint8_t icon_id,Color text_color); }; class EHMTXNextScreenTrigger : public Trigger