Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.4.0: Fix for Night loop #226

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions components/ehmtxv2/EHMTX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion components/ehmtxv2/EHMTX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 16 additions & 3 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
SVG_END = "</svg>"

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"")
Expand Down Expand Up @@ -577,12 +577,21 @@ 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")
logging.info(f"[X] Rainbow shimmer")

if config[CONF_SCROLL_SMALL_TEXT]:
cg.add_define("EHMTXv2_SCROLL_SMALL_TEXT")
Expand All @@ -595,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")
Expand Down
Loading