Skip to content

Commit

Permalink
2024.1.0: Advanced Boot Logo - Add boot modes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Jan 2, 2024
1 parent aee426a commit 9502ca4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
19 changes: 17 additions & 2 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,10 @@ namespace esphome
{
#ifdef USE_ESP32
#ifdef EHMTXv2_ADV_BOOT

if (this->boot_logo != NULL)
{
/*
#if defined EHMTXv2_ADV_BOOT_MODE_0 || defined EHMTXv2_ADV_BOOT_MODE_2
if (this->boot_anim % EHMTXv2_RAINBOW_INTERVALL == 0)
{
for (uint8_t x = 0; x < 32; x++)
Expand All @@ -1343,12 +1344,17 @@ namespace esphome
{
if (this->boot_logo[x + y * 32] == 1)
{
#ifdef EHMTXv2_ADV_BOOT_MODE_0
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);
#endif
}
}
}
}
*/
#endif
#if defined EHMTXv2_ADV_BOOT_MODE_1 || defined EHMTXv2_ADV_BOOT_MODE_3
if (this->boot_anim % 8 == 0)
{
uint8_t w = 2 + ((uint8_t)(32 / 16) * (this->boot_anim * 2 / 16)) % 32;
Expand All @@ -1358,14 +1364,23 @@ namespace esphome
{
if (this->boot_logo[l + y * 32] == 1)
{
#ifdef EHMTXv2_ADV_BOOT_MODE_1
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
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);
#endif
}
}
}
#endif
}
else
#endif
Expand Down
6 changes: 3 additions & 3 deletions components/ehmtxv2/EHMTX_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,12 @@ namespace esphome
this->config_->display->line(8, this->ypos(), 8, this->ypos() + 7, esphome::display::COLOR_OFF);
if (this->icon == SOLIDICON)
{
this->config_->display->filled_rectangle(0, this->ypos(), 8, 8, this->config_->solid_color);
this->config_->display->filled_rectangle(0, this->ypos(), 8, 8, this->config_->solid_color);
}
else if (this->icon == CALENDARICON)
{
this->config_->display->filled_rectangle(0, this->ypos(), 8, 8, Color(C_RED, C_GREEN, C_BLUE));
this->config_->display->filled_rectangle(0, this->ypos(), 8, 2, this->config_->calendar_color);
this->config_->display->filled_rectangle(0, this->ypos(), 8, 8, Color(C_RED, C_GREEN, C_BLUE));
this->config_->display->filled_rectangle(0, this->ypos(), 8, 2, this->config_->calendar_color);
}
else
{
Expand Down
12 changes: 12 additions & 0 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def rgb565_888(v565):
CONF_BITMAP = "advanced_bitmap"
CONF_BOOT = "advanced_boot"
CONF_BOOTLOGO = "boot_logo"
CONF_BOOTMODE = "boot_mode"
CONF_FRAMEDURATION = "frame_duration"
CONF_SCROLLCOUNT = "scroll_count"
CONF_MATRIXCOMPONENT = "matrix_component"
Expand Down Expand Up @@ -175,6 +176,9 @@ def rgb565_888(v565):
CONF_BOOT, default=False
): cv.boolean,
cv.Optional(CONF_BOOTLOGO): cv.string,
cv.Optional(
CONF_BOOTMODE, default="2"
): cv.templatable(cv.int_range(min=0, max=3)),
cv.Optional(
CONF_SHOW_SECONDS, default=False
): cv.boolean,
Expand Down Expand Up @@ -592,6 +596,14 @@ def thumbnails(frames):
if config[CONF_BOOT] and config.get(CONF_BOOTLOGO):
cg.add_define("EHMTXv2_ADV_BOOT")
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] == 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_NIGHT_MODE_SCREENS]:
cg.add_define("EHMTXv2_CONF_NIGHT_MODE_SCREENS",config[CONF_NIGHT_MODE_SCREENS])
Expand Down

0 comments on commit 9502ca4

Please sign in to comment.