[core] Invert feed_wdt condition so slow-path call is inside the if

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.
This commit is contained in:
J. Nick Koston
2026-04-11 14:57:01 -10:00
parent 715f0ca6f7
commit dc5626eb85
+2 -3
View File
@@ -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<uint32_t>(time - this->last_wdt_feed_) <= WDT_FEED_INTERVAL_MS) {
return;
if (time == 0 || static_cast<uint32_t>(time - this->last_wdt_feed_) > WDT_FEED_INTERVAL_MS) {
this->feed_wdt_slow_(time);
}
this->feed_wdt_slow_(time);
}
void reboot();