Skip to content

Commit

Permalink
Merge pull request #193 from andrewjswan/2024.1.0-Simplifying_the_Adv…
Browse files Browse the repository at this point in the history
…anced_boot_logo

2024.1.0: Simplifying the Advanced boot logo

I have to check it in detail but the direction is the way i like!
  • Loading branch information
lubeda authored Jan 5, 2024
2 parents 197e813 + f04a050 commit 26fae3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
10 changes: 5 additions & 5 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -1363,15 +1363,15 @@ 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);
#endif
}
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);
Expand Down
19 changes: 9 additions & 10 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit 26fae3b

Please sign in to comment.