From f04a0506f3fed30dbd778c6ca86f389c3688f692 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Fri, 5 Jan 2024 00:00:34 +0200 Subject: [PATCH] 2024.1.0: Simplifying the Advanced boot logo --- components/ehmtxv2/EHMTX.cpp | 10 +++++----- components/ehmtxv2/__init__.py | 19 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 372b10ef..0c3296cb 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -1337,14 +1337,14 @@ namespace esphome if (this->boot_logo != NULL) { - #if defined EHMTXv2_ADV_BOOT_MODE_0 || defined EHMTXv2_ADV_BOOT_MODE_2 + #if defined EHMTXv2_ADV_BOOT_MODE_1 || defined EHMTXv2_ADV_BOOT_MODE_3 for (uint8_t x = 0; x < 32; x++) { for (uint8_t y = 0; y < 8; y++) { if (this->boot_logo[x + y * 32] == 1) { - #ifdef EHMTXv2_ADV_BOOT_MODE_0 + #ifdef EHMTXv2_ADV_BOOT_MODE_1 this->display->draw_pixel_at(x, y, Color(C_RED, C_GREEN, C_BLUE)); #else this->display->draw_pixel_at(x, y, this->rainbow_color); @@ -1353,7 +1353,7 @@ namespace esphome } } #endif - #if defined EHMTXv2_ADV_BOOT_MODE_1 || defined EHMTXv2_ADV_BOOT_MODE_3 + #if defined EHMTXv2_ADV_BOOT_MODE_2 || defined EHMTXv2_ADV_BOOT_MODE_4 if (this->boot_anim % 8 == 0) { uint8_t w = 2 + ((uint8_t)(32 / 16) * (this->boot_anim * 2 / 16)) % 32; @@ -1363,7 +1363,7 @@ namespace esphome { if (this->boot_logo[l + y * 32] == 1) { - #ifdef EHMTXv2_ADV_BOOT_MODE_1 + #ifdef EHMTXv2_ADV_BOOT_MODE_2 this->display->draw_pixel_at(l, y, Color(C_RED, C_GREEN, C_BLUE)); #else this->display->draw_pixel_at(l, y, this->rainbow_color); @@ -1371,7 +1371,7 @@ namespace esphome } if (this->boot_logo[r + y * 32] == 1) { - #ifdef EHMTXv2_ADV_BOOT_MODE_1 + #ifdef EHMTXv2_ADV_BOOT_MODE_2 this->display->draw_pixel_at(r, y, Color(C_RED, C_GREEN, C_BLUE)); #else this->display->draw_pixel_at(r, y, this->rainbow_color); diff --git a/components/ehmtxv2/__init__.py b/components/ehmtxv2/__init__.py index f1384011..537cb017 100644 --- a/components/ehmtxv2/__init__.py +++ b/components/ehmtxv2/__init__.py @@ -98,7 +98,6 @@ def rgb565_888(v565): CONF_VERTICAL = "vertical_scroll" CONF_CLOCK = "advanced_clock" CONF_BITMAP = "advanced_bitmap" -CONF_BOOT = "advanced_boot" CONF_BOOTLOGO = "boot_logo" CONF_BOOTMODE = "boot_mode" CONF_FRAMEDURATION = "frame_duration" @@ -173,12 +172,11 @@ def rgb565_888(v565): CONF_BITMAP, default=False ): cv.boolean, cv.Optional( - CONF_BOOT, default=False - ): cv.boolean, - cv.Optional(CONF_BOOTLOGO): cv.string, + CONF_BOOTLOGO + ): cv.string, cv.Optional( - CONF_BOOTMODE, default="2" - ): cv.templatable(cv.int_range(min=0, max=3)), + CONF_BOOTMODE, default="0" + ): cv.templatable(cv.int_range(min=0, max=4)), cv.Optional( CONF_SHOW_SECONDS, default=False ): cv.boolean, @@ -593,17 +591,18 @@ def thumbnails(frames): if config[CONF_BITMAP]: cg.add_define("EHMTXv2_ADV_BITMAP") - if config[CONF_BOOT] and config.get(CONF_BOOTLOGO): - cg.add_define("EHMTXv2_ADV_BOOT") + if config.get(CONF_BOOTLOGO) and config[CONF_BOOTMODE]: cg.add(var.set_boot_logo(config[CONF_BOOTLOGO])) - if config[CONF_BOOTMODE] == 0: - cg.add_define("EHMTXv2_ADV_BOOT_MODE_0") + if config[CONF_BOOTMODE] > 0: + cg.add_define("EHMTXv2_ADV_BOOT") if config[CONF_BOOTMODE] == 1: cg.add_define("EHMTXv2_ADV_BOOT_MODE_1") if config[CONF_BOOTMODE] == 2: cg.add_define("EHMTXv2_ADV_BOOT_MODE_2") if config[CONF_BOOTMODE] == 3: cg.add_define("EHMTXv2_ADV_BOOT_MODE_3") + if config[CONF_BOOTMODE] == 4: + cg.add_define("EHMTXv2_ADV_BOOT_MODE_4") if config[CONF_NIGHT_MODE_SCREENS]: cg.add_define("EHMTXv2_CONF_NIGHT_MODE_SCREENS",config[CONF_NIGHT_MODE_SCREENS])