From dc5626eb855829ad8f54fa9a1e9908831f65eed3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 11 Apr 2026 14:57:01 -1000 Subject: [PATCH] [core] Invert feed_wdt condition so slow-path call is inside the if MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleaner than the early-return form — the action (calling feed_wdt_slow_) reads as the body of the conditional instead of falling through past a guard clause. Logically identical and compiles to the same code. --- esphome/core/application.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/esphome/core/application.h b/esphome/core/application.h index 7cde0bf85d..02af5664a4 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -398,10 +398,9 @@ class Application { /// Pass time==0 to request millis() be read for you (low-frequency callers /// only — always takes the slow path). void ESPHOME_ALWAYS_INLINE feed_wdt(uint32_t time = 0) { - if (time != 0 && static_cast(time - this->last_wdt_feed_) <= WDT_FEED_INTERVAL_MS) { - return; + if (time == 0 || static_cast(time - this->last_wdt_feed_) > WDT_FEED_INTERVAL_MS) { + this->feed_wdt_slow_(time); } - this->feed_wdt_slow_(time); } void reboot();