From 0171385448d7ca3fe2cf564347aaca059e9aa9b4 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Mon, 9 Oct 2023 10:23:38 +0300 Subject: [PATCH 1/5] 2023.9.1: Add mode 5 for day, to the center, without leading 0 --- components/ehmtxv2/EHMTX_queue.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/ehmtxv2/EHMTX_queue.cpp b/components/ehmtxv2/EHMTX_queue.cpp index 7d7f35eb..785790ba 100644 --- a/components/ehmtxv2/EHMTX_queue.cpp +++ b/components/ehmtxv2/EHMTX_queue.cpp @@ -409,6 +409,8 @@ namespace esphome case 3: // To the center, the right one is a pixel higher. case 4: + // To the center, without leading 0 + case 5: x_left = (l_width < 5) ? 5 - l_width : 0; x_right = 4; break; @@ -422,8 +424,16 @@ namespace esphome x_right = x_right - r_width; break; } - this->config_->display->printf(x_left, yoffset + this->config_->info_y_offset - (mode != 3 ? 0 : 1), info_font, this->config_->info_lcolor, display::TextAlign::BASELINE_LEFT, "%d", d / 10 % 10); - this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset - (mode != 4 ? 0 : 1), info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10); + if (mode == 5 && (d / 10 % 10) == 0) + { + x_right = 4 - (r_width - 1) / 2; + this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset, info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10); + } + else + { + this->config_->display->printf(x_left, yoffset + this->config_->info_y_offset - (mode != 3 ? 0 : 1), info_font, this->config_->info_lcolor, display::TextAlign::BASELINE_LEFT, "%d", d / 10 % 10); + this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset - (mode != 4 ? 0 : 1), info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10); + } } else // if (this->icon_name.rfind("weekday", 0) == 0) { From 48b031cebab1ab9bd65c6a91ca72662b71941aef Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Mon, 9 Oct 2023 10:25:20 +0300 Subject: [PATCH 2/5] 2023.9.1: Add mode 5 for day, to the center, without leading 0 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3acdc107..a293bab7 100644 --- a/README.md +++ b/README.md @@ -1098,6 +1098,7 @@ A common format for specifying output options: `icon|mode#draw_mode` - 2 - Left to center, Right to edge - 3 - To the center, the left one is a pixel higher - 4 - To the center, the right one is a pixel higher +- 5 - To the center, without leading 0 (**only for day**) https://github.com/lubeda/EspHoMaTriXv2/issues/92#issuecomment-1750184472 From d2681e9025ecbb18c91be7d1851bbd78a139acb8 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Mon, 9 Oct 2023 19:14:10 +0300 Subject: [PATCH 3/5] 2023.9.1: Remove floating point operation --- components/ehmtxv2/EHMTX_queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ehmtxv2/EHMTX_queue.cpp b/components/ehmtxv2/EHMTX_queue.cpp index 785790ba..2427100c 100644 --- a/components/ehmtxv2/EHMTX_queue.cpp +++ b/components/ehmtxv2/EHMTX_queue.cpp @@ -424,7 +424,7 @@ namespace esphome x_right = x_right - r_width; break; } - if (mode == 5 && (d / 10 % 10) == 0) + if (mode == 5 && (d < 10)) { x_right = 4 - (r_width - 1) / 2; this->config_->display->printf(x_right, yoffset + this->config_->info_y_offset, info_font, this->config_->info_rcolor, display::TextAlign::BASELINE_LEFT, "%d", d % 10); From 5160a74232c4cf9a87637d5d2268974bdec69522 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Wed, 11 Oct 2023 10:54:18 +0300 Subject: [PATCH 4/5] 2023.9.1: Add weekdays example to readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a293bab7..edc12321 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,13 @@ - Added icon and date output screen - `icon_date(iconname, lifetime, screen_time, default_font, r, g, b)` - If pass a screen identifier with the value `[day, weekday]` like `icon_name|day`, and a backing icon to `icon_clock` or `icon_date`, it will display text. -- New YAML option `weekdays: "SUMOTUWETHFRSA"` and new function to customize the info text over the icon: +- New YAML option `weekdays: "SUMOTUWETHFRSA"` (**7 or 14** characters) and new function to customize the info text over the icon: - `set_infotext_color(200,100,100,100,100,200,false,2);` - `set_infotext_color("left_r", "left_g", "left_b", "right_r", "right_g", "right_b", "default_font", "y_offset");` - `weekdays` - the order of the days of the week, from Sunday to Saturday. +- Example for **weekdays**: + - `weekdays: "일월화수목금토"` + - `weekdays: "НДПНВТСРЧТПТСБ"` - Added a screen with the ability to display a progress bar, progress value `(-100..100)` - `icon_screen_progress(iconname, text, progress, lifetime, screen_time, default_font, r, g, b)` From 883538ad8e780bb9fab0745eacfdd7d8bd5cfa19 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Wed, 11 Oct 2023 12:04:29 +0300 Subject: [PATCH 5/5] 2023.9.1: Add weekdays description to readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index edc12321..10f12f0f 100644 --- a/README.md +++ b/README.md @@ -662,6 +662,13 @@ ehmtxv2: **week_start_monday** (optional, bool): default Monday is first day of week, false => Sunday +**weekdays** (optional, string, default: "SUMOTUWETHFRSA"): Abbreviations of the days of the week, starting from Sunday, from *7 to 14* characters. + +Example: + - `weekdays: "SUMOTUWETHFRSA"` + - `weekdays: "일월화수목금토"` + - `weekdays: "НДПНВТСРЧТПТСБ"` + **scroll_interval** (optional, ms): the interval in ms to scroll the text (default=80), should be a multiple of the ```update_interval``` of the [display](https://esphome.io/components/display/addressable_light.html) **clock_interval** (optional, s): the interval in seconds to force the clock display. By default, the clock screen, if any, will be displayed according to the position in the queue. **If you set the clock_interval close to the screen_time of the clock, you will only see the clock!** (default=0)