mirror of
https://github.com/esphome/esphome.git
synced 2025-11-16 23:05:46 +00:00
[scheduler] Fix timing breakage after 49 days of uptime on ESP8266/RP2040 (#11924)
This commit is contained in:
@@ -609,13 +609,12 @@ uint64_t Scheduler::millis_64_(uint32_t now) {
|
|||||||
if (now < last && (last - now) > HALF_MAX_UINT32) {
|
if (now < last && (last - now) > HALF_MAX_UINT32) {
|
||||||
this->millis_major_++;
|
this->millis_major_++;
|
||||||
major++;
|
major++;
|
||||||
|
this->last_millis_ = now;
|
||||||
#ifdef ESPHOME_DEBUG_SCHEDULER
|
#ifdef ESPHOME_DEBUG_SCHEDULER
|
||||||
ESP_LOGD(TAG, "Detected true 32-bit rollover at %" PRIu32 "ms (was %" PRIu32 ")", now, last);
|
ESP_LOGD(TAG, "Detected true 32-bit rollover at %" PRIu32 "ms (was %" PRIu32 ")", now, last);
|
||||||
#endif /* ESPHOME_DEBUG_SCHEDULER */
|
#endif /* ESPHOME_DEBUG_SCHEDULER */
|
||||||
}
|
} else if (now > last) {
|
||||||
|
// Only update if time moved forward
|
||||||
// Only update if time moved forward
|
|
||||||
if (now > last) {
|
|
||||||
this->last_millis_ = now;
|
this->last_millis_ = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user