From 7f76f3726fe3cb5ea403b52d2fc190feaa2326a4 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 6 Sep 2021 04:47:13 +0200 Subject: [PATCH] LOG_UPDATE_INTERVAL: correctly report "never" (#2240) --- esphome/core/component.h | 6 +++++- esphome/core/scheduler.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/core/component.h b/esphome/core/component.h index b9a22c240e..a84f612dd9 100644 --- a/esphome/core/component.h +++ b/esphome/core/component.h @@ -38,8 +38,12 @@ extern const float LATE; } // namespace setup_priority +static const uint32_t SCHEDULER_DONT_RUN = 4294967295UL; + #define LOG_UPDATE_INTERVAL(this) \ - if (this->get_update_interval() < 100) { \ + if (this->get_update_interval() == SCHEDULER_DONT_RUN) { \ + ESP_LOGCONFIG(TAG, " Update Interval: never"); \ + } else if (this->get_update_interval() < 100) { \ ESP_LOGCONFIG(TAG, " Update Interval: %.3fs", this->get_update_interval() / 1000.0f); \ } else { \ ESP_LOGCONFIG(TAG, " Update Interval: %.1fs", this->get_update_interval() / 1000.0f); \ diff --git a/esphome/core/scheduler.cpp b/esphome/core/scheduler.cpp index 60e0d4e9bd..5718e3b396 100644 --- a/esphome/core/scheduler.cpp +++ b/esphome/core/scheduler.cpp @@ -7,7 +7,6 @@ namespace esphome { static const char *const TAG = "scheduler"; -static const uint32_t SCHEDULER_DONT_RUN = 4294967295UL; static const uint32_t MAX_LOGICALLY_DELETED_ITEMS = 10; // Uncomment to debug scheduler