From e4a4cc6778b5e51e71d43d7bc10ea57c28cc393a Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Tue, 14 Nov 2023 20:28:30 +0200 Subject: [PATCH] 2023.9.1-133: Fix for Screens re-starts and showing twice if 'force_screen' send Co-authored-by: chertvl <38353584+chertvl@users.noreply.github.com> --- components/ehmtxv2/EHMTX.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/ehmtxv2/EHMTX.cpp b/components/ehmtxv2/EHMTX.cpp index 40f834ba..20eb2a0d 100644 --- a/components/ehmtxv2/EHMTX.cpp +++ b/components/ehmtxv2/EHMTX.cpp @@ -748,9 +748,12 @@ namespace esphome if (force) { ESP_LOGD(TAG, "force_screen: found position: %d", i); - this->queue[i]->last_time = 0.0; - this->queue[i]->endtime += this->queue[i]->screen_time_; this->next_action_time = this->get_tick(); + this->queue[i]->last_time = 0.0; + if (this->queue[i]->endtime < this->next_action_time + this->queue[i]->screen_time_) + { + this->queue[i]->endtime = this->next_action_time + this->queue[i]->screen_time_; + } ESP_LOGW(TAG, "force_screen: icon %s in mode %d", icon_name.c_str(), mode); } } @@ -839,7 +842,7 @@ namespace esphome if (this->clock->now().is_valid()) { std::string infotext; - float ts = this->get_tick(); + float ts = this->get_tick() + static_cast(EHMTXv2_SCROLL_INTERVALL); // Force remove expired queue element for (size_t i = 0; i < MAXQUEUE; i++) {