From 31d78aa1b1666b73378411ad279474d66f6ab244 Mon Sep 17 00:00:00 2001 From: lubeda Date: Wed, 11 Dec 2024 13:30:35 +0100 Subject: [PATCH] prep 2024.12.1 --- CHANGELOG.md | 4 ++ README.md | 46 ++++++++------------ components/ehmtxv2/EHMTX.cpp | 67 ------------------------------ components/ehmtxv2/EHMTX_queue.cpp | 7 ---- components/ehmtxv2/__init__.py | 7 ---- install/ulanzi-easy.yaml | 5 +-- 6 files changed, 23 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07116db..65e9210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2024.12.1 +- prepared for esphome 2024.12.0 +- removed multicolor_text + ## 2024.5.0 - changed on_empty_queue behavior (triggered every 15 sec after first occurance) diff --git a/README.md b/README.md index e053521..8a4d2bd 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,22 @@ > [!TIP] > If you like this project, please donate a star on GitHub and consider [sponsoring](https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU) me 🙏 ! +## Important breaking news + +The latest esphome releases introduced a lot of problems with my code. So my advice alway use the latest version of this tool and use it directly from the repo, like this: + +```yaml +external_components: + - source: + type: git + url: https://github.com/lubeda/EspHoMaTriXv2 + ref: 2024.12.1 + refresh: 60s + components: [ ehmtxv2 ] +``` + +Use the `ref` parameter to select the right version. **But** when there are breaking changes in esphome you have to expect breaking changes in EspHoMaTriX too (at least some funnny workarounds) + ## Important breaking news for ulanzi TC001 users With the ulanzi-hardware and esphome 2024.2.0 you have to remove all the rtttl stuff to make things work!!! @@ -373,35 +389,6 @@ Example: **rainbow_shimmer** (optional, boolean): If true, enables color shimmer when displaying text in rainbow modes. -**multicolor_text** (optional, boolean): If true, enables text multi color support when displaying text. - -Example: -```Yaml -ehmtxv2: - id: rgb8x32 -... - multicolor_text: true -``` - -```Yaml -service: esphome.ulanzi_text_screen -data: - default_font: true - text: "Default Color Text #00FF00Green Color Text #FF0000Red Color Text #0000FFBlue Color Text #000000Default Color Text" - lifetime: 2 - screen_time: 10 - r: 255 - g: 255 - b: 255 -``` -Shows text in different colors, `Default Color Text` in the default color `#FFFFFF` (r: 255, g:255, b: 255), followed by `Green Color Text` in green `#00FF00`, then `Red Color Text` in red `#FF0000`, then `Blue Color Text` in blue `#0000FF` and finally `Default Color Text` in default color, due `#000000`. - -> [!WARNING] -> In this mode, with a large number of color changes, or with long lines, a short-term decrease in performance is possible. -> -> ```[13:26:02][W][component:237]: Component display took a long time for an operation (55 ms).``` -> ```[13:26:02][W][component:238]: Components should block for at most 30 ms.``` - **icons2html** (optional, boolean): If true, generate the HTML-file (*filename*.html) to show all included icons. (default = `false`) **iconscache** (optional, boolean): If true, it caches icons in the `.cache\icons` folder and if it finds the specified icons in the cache, it uses them instead of trying to download them again from the Internet. (default = `false`) @@ -1849,3 +1836,4 @@ THE SOFTWARE IS PROVIDED “AS IS”, use at your own risk! ## Special thanks to all sponsors As of the 6/1/2024 there were only six of them. 😿 + diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 7a4d2e6..5db19ee 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -2890,74 +2890,7 @@ namespace esphome void EHMTX::draw_text(std::string text, esphome::display::BaseFont *font, Color color, int xpos, int ypos) { - #ifdef EHMTXv2_MULTICOLOR_TEXT - std::size_t pos = text.find("#"); - if (pos == std::string::npos) - { this->display->print(xpos, ypos, font, color, esphome::display::TextAlign::BASELINE_LEFT, text.c_str()); - return; - } - - std::regex regex ("(#[A-Fa-f0-9]{6})|(.+?)"); - - std::regex_iterator next ( text.begin(), text.end(), regex ); - std::regex_iterator end; - - std::vector res; - - std::string iter = ""; - while (next != end) - { - std::string part = next->str(); - if (part.length() == 7) - { - if (iter.length() > 0) - { - res.push_back (iter); - iter = ""; - } - res.push_back (part); - } - else - { - iter += part; - } - next++; - } - if (iter.length() > 0) - { - res.push_back (iter); - } - - Color c = color; - int x = xpos; - std::regex is_color ("^#[A-Fa-f0-9]{6}$"); - for (int i = 0; i < res.size(); i++) - { - if (res.at(i).length() > 0) - { - int r, g, b; - if (res.at(i).length() == 7 && std::regex_match(res.at(i), is_color) && sscanf(&res.at(i).c_str()[1], "%02x%02x%02x", &r, &g, &b)) - { - if (r + g + b > 0) - { - c = Color(r, g ,b); - } - else - { - c = color; - } - } - else - { - this->display->print(x, ypos, font, c, esphome::display::TextAlign::BASELINE_LEFT, res.at(i).c_str()); - x += this->GetTextWidth(font, "%s", res.at(i).c_str()); - } - } - } - #else - this->display->print(xpos, ypos, font, color, esphome::display::TextAlign::BASELINE_LEFT, text.c_str()); - #endif } #ifdef EHMTXv2_RAINBOW_SHIMMER diff --git a/components/ehmtxv2/EHMTX_queue.cpp b/components/ehmtxv2/EHMTX_queue.cpp index d8f4a6e..d47f6f0 100644 --- a/components/ehmtxv2/EHMTX_queue.cpp +++ b/components/ehmtxv2/EHMTX_queue.cpp @@ -1,7 +1,4 @@ #include "esphome.h" -#ifdef EHMTXv2_MULTICOLOR_TEXT -#include -#endif namespace esphome { @@ -1232,10 +1229,6 @@ namespace esphome uint16_t max_steps = 0; std::string text_ = text; -#ifdef EHMTXv2_MULTICOLOR_TEXT - std::regex color_re("(#[A-Fa-f0-9]{6})"); - text_ = std::regex_replace(text, color_re, ""); -#endif if (this->default_font) { diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index 36d70b6..798f2d9 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -109,7 +109,6 @@ def rgb565_888(v565): CONF_BLENDSTEPS = "blend_steps" CONF_RAINBOWINTERVAL = "rainbow_interval" CONF_RAINBOWSHIMMER = "rainbow_shimmer" -CONF_MULTICOLOR_TEXT = "multicolor_text" CONF_FRAMEINTERVAL = "frame_interval" CONF_DEFAULT_FONT_ID = "default_font_id" CONF_DEFAULT_FONT = "default_font" @@ -242,8 +241,6 @@ def rgb565_888(v565): ): cv.templatable(cv.positive_int), cv.Optional(CONF_RAINBOWSHIMMER, default=False ): cv.boolean, - cv.Optional(CONF_MULTICOLOR_TEXT, default=False - ): cv.boolean, cv.Optional(CONF_SCROLLCOUNT, default="2" ): cv.templatable(cv.positive_int), cv.Optional( @@ -616,10 +613,6 @@ def thumbnails(frames): cg.add_define("EHMTXv2_RAINBOW_SHIMMER") logging.info(f"[X] Rainbow shimmer") - if config[CONF_MULTICOLOR_TEXT]: - cg.add_define("EHMTXv2_MULTICOLOR_TEXT") - logging.info(f"[X] Multi color text") - if config[CONF_SCROLL_SMALL_TEXT]: cg.add_define("EHMTXv2_SCROLL_SMALL_TEXT") diff --git a/install/ulanzi-easy.yaml b/install/ulanzi-easy.yaml index ba6541d..59d0648 100644 --- a/install/ulanzi-easy.yaml +++ b/install/ulanzi-easy.yaml @@ -58,7 +58,7 @@ external_components: - source: type: git url: https://github.com/lubeda/EspHoMaTriXv2 - ref: "2024.12.0" + ref: "2024.12.1" refresh: 600s components: [ ehmtxv2 ] @@ -67,7 +67,7 @@ esphome: name: $devicename project: name: "Ulanzi.EHMTXv2" - version: "2024.12.0" + version: "2024.12.1" on_boot: then: - ds1307.read_time: @@ -229,7 +229,6 @@ ehmtxv2: show_seconds: false default_font_id: px6_font default_font_yoffset: 7 - multicolor_text: true special_font_id: px6_font special_font_yoffset: 7 # until here