From e30be135ca8dbb89f2894484bb3e06643165a7b6 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Sun, 31 Mar 2024 21:47:44 +0300 Subject: [PATCH 1/2] 2024.4.0: Fix for Night loop https://github.com/lubeda/EspHoMaTriXv2/issues/225 Co-authored-by: popy2k14 --- components/ehmtxv2/EHMTX.cpp | 26 ++++++++++++++++++++++++++ components/ehmtxv2/EHMTX.h | 2 +- components/ehmtxv2/__init__.py | 14 +++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index c73733f..d070616 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -979,6 +979,11 @@ namespace esphome float last_time = this->get_tick(); for (size_t i = 0; i < MAXQUEUE; i++) { + if (this->queue[i]->mode == MODE_EMPTY) + { + continue; + } + if (this->night_mode) { bool skip = true; @@ -1159,6 +1164,27 @@ namespace esphome uint8_t c = 0; for (size_t i = 0; i < MAXQUEUE; i++) { + if (this->queue[i]->mode == MODE_EMPTY) + { + continue; + } + + if (this->night_mode) + { + bool skip = true; + for (auto id : EHMTXv2_CONF_NIGHT_MODE_SCREENS) + { + if (this->queue[i]->mode == id) + { + skip = false; + } + } + if (skip) + { + continue; + } + } + if (this->queue[i]->endtime > ts) { c++; diff --git a/components/ehmtxv2/EHMTX.h b/components/ehmtxv2/EHMTX.h index a5ed201..738f33d 100644 --- a/components/ehmtxv2/EHMTX.h +++ b/components/ehmtxv2/EHMTX.h @@ -81,7 +81,7 @@ namespace esphome protected: float get_setup_priority() const override { return esphome::setup_priority::LATE; } uint8_t brightness_ = 0; - uint8_t target_brightness_; + uint8_t target_brightness_ = 0; uint32_t boot_anim = 0; uint8_t screen_pointer; bool show_day_of_week; diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index 9777a69..6c31e58 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -31,7 +31,7 @@ SVG_END = "" logging.warning(f"") -logging.warning(f"!!!!This version (2024.3.0) has breaking changes!!!!") +logging.warning(f"!!!! This version (2024.4.0) has breaking changes !!!!") logging.warning(f"Please check the documentation and wiki https://github.com/lubeda/EspHoMaTriXv2") logging.warning(f"This will only work with esphome >= 2023.7.0") logging.warning(f"") @@ -577,9 +577,17 @@ def thumbnails(frames): cg.add_define("EHMTXv2_SPECIAL_FONT_OFFSET_X",config[CONF_SPECIAL_FONT_XOFFSET]) cg.add_define("EHMTXv2_SPECIAL_FONT_OFFSET_Y",config[CONF_SPECIAL_FONT_YOFFSET]) cg.add_define("EHMTXv2_TIME_FORMAT",config[CONF_TIME_FORMAT]) - cg.add_define("EHMTXv2_TIME_FORMAT_BIG",config[CONF_TIME_FORMAT_BIG]) cg.add_define("EHMTXv2_DATE_FORMAT",config[CONF_DATE_FORMAT]) - cg.add_define("EHMTXv2_DATE_FORMAT_BIG",config[CONF_DATE_FORMAT_BIG]) + + if config[CONF_TIME_FORMAT_BIG]: + cg.add_define("EHMTXv2_TIME_FORMAT_BIG",config[CONF_TIME_FORMAT_BIG]) + else: + cg.add_define("EHMTXv2_TIME_FORMAT_BIG",config[EHMTXv2_TIME_FORMAT]) + + if config[CONF_DATE_FORMAT_BIG]: + cg.add_define("EHMTXv2_DATE_FORMAT_BIG",config[CONF_DATE_FORMAT_BIG]) + else: + cg.add_define("EHMTXv2_DATE_FORMAT_BIG",config[CONF_DATE_FORMAT]) if config[CONF_RAINBOWSHIMMER]: cg.add_define("EHMTXv2_RAINBOW_SHIMMER") From f0a111b7a5da91f98f498fa4c0622c5691e73d1a Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Mon, 1 Apr 2024 12:11:11 +0300 Subject: [PATCH 2/2] 2024.4.0: Add info for Advanced clock and Bitmap --- components/ehmtxv2/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index 6c31e58..b49d317 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -591,6 +591,7 @@ def thumbnails(frames): if config[CONF_RAINBOWSHIMMER]: cg.add_define("EHMTXv2_RAINBOW_SHIMMER") + logging.info(f"[X] Rainbow shimmer") if config[CONF_SCROLL_SMALL_TEXT]: cg.add_define("EHMTXv2_SCROLL_SMALL_TEXT") @@ -603,16 +604,20 @@ def thumbnails(frames): if config[CONF_VERTICAL]: cg.add_define("EHMTXv2_USE_VERTICAL_SCROLL") + logging.info(f"[X] Vertical scroll") if config[CONF_CLOCK]: cg.add_define("EHMTXv2_ADV_CLOCK") + logging.info(f"[X] Advanced clock mode") if config[CONF_BITMAP]: cg.add_define("EHMTXv2_ADV_BITMAP") + logging.info(f"[X] Advanced bitmap mode") if config.get(CONF_BOOTLOGO): cg.add(var.set_boot_logo(config[CONF_BOOTLOGO])) cg.add_define("EHMTXv2_ADV_BOOT") + logging.info(f"[X] Advanced boot") if config[CONF_BOOTLOGOMODE] == 0: cg.add_define("EHMTXv2_ADV_BOOT_MODE_0")