From 73345252f7d65a461948b53aeed6fbe73eb97c91 Mon Sep 17 00:00:00 2001 From: LuBeDa Date: Mon, 11 Jul 2022 20:42:29 +0200 Subject: [PATCH] fixed issue #19 --- components/ehmtx/EHMTX.cpp | 7 ++++--- components/ehmtx/EHMTX.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/ehmtx/EHMTX.cpp b/components/ehmtx/EHMTX.cpp index 3507114..eabea29 100644 --- a/components/ehmtx/EHMTX.cpp +++ b/components/ehmtx/EHMTX.cpp @@ -131,7 +131,8 @@ namespace esphome { if (this->clock->now().timestamp > 6000) // valid time { - if (!this->show_date or ((this->clock->now().timestamp - this->next_action_time) < this->clock_time)) + time_t ts = this->clock->now().timestamp; + if (!this->show_date or ((this->next_action_time - ts) < this->clock_time)) { this->display->strftime(this->xoffset + 15, this->yoffset, this->font, this->clock_color, display::TextAlign::BASELINE_CENTER, this->time_fmt.c_str(), this->clock->now()); @@ -203,8 +204,8 @@ namespace esphome } if (this->show_screen == false) { - ESP_LOGD(TAG, "next action: show clock for %d sec",this->screen_time); - this->last_clock_time = this->clock->now().timestamp; + ESP_LOGD(TAG, "next action: show clock/date for %d/%d sec",this->clock_time, this->screen_time-this->clock_time); + this->last_clock_time = ts; this->next_action_time = ts + this->screen_time; } else diff --git a/components/ehmtx/EHMTX.h b/components/ehmtx/EHMTX.h index 65283ca..7cc0b5e 100644 --- a/components/ehmtx/EHMTX.h +++ b/components/ehmtx/EHMTX.h @@ -8,7 +8,7 @@ const uint8_t TEXTSCROLLSTART = 8; const uint8_t TEXTSTARTOFFSET = (32 - 8); const uint16_t TICKINTERVAL = 1000; // each 1000ms -static const char *const EHMTX_VERSION = "Version: 2022.6.2"; +static const char *const EHMTX_VERSION = "Version: 2022.7.0"; static const char *const TAG = "EHMTX"; namespace esphome