mirror of
https://github.com/esphome/esphome.git
synced 2026-05-25 02:16:13 +08:00
[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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user