From 134527de5f30d061d43ae06c59225bee7a503aea Mon Sep 17 00:00:00 2001 From: jpirnay Date: Fri, 17 Apr 2026 23:21:03 +0200 Subject: [PATCH] Dont hammer the bus --- lib/hal/HalClock.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/hal/HalClock.cpp b/lib/hal/HalClock.cpp index 81cf472a..e7d83ed9 100644 --- a/lib/hal/HalClock.cpp +++ b/lib/hal/HalClock.cpp @@ -545,13 +545,14 @@ void updatePeriodic() { // DS3231 (if present) has priority, synchronize the system time // every 10 minutes directly against the RTC, instead of calculating. if (initExternalRTC()) { - time_t rtcTime = readExternalRTC(); unsigned long nowMs = millis(); - if ((nowMs - lastPeriodicUpdateMs >= PERIODIC_UPDATE_INTERVAL_MS) && - (rtcTime > 1577836800)) { // Check if time is after 2020 (plausible timestamp) - lastPeriodicUpdateMs = nowMs; - setSystemClock(rtcTime); - LOG_DBG("CLK", "Systemtime has been taken from DS3231"); + if (nowMs - lastPeriodicUpdateMs >= PERIODIC_UPDATE_INTERVAL_MS) { + time_t rtcTime = readExternalRTC(); + if (rtcTime > 1577836800) { // Check if time is after 2020 (plausible timestamp) + lastPeriodicUpdateMs = nowMs; + setSystemClock(rtcTime); + LOG_DBG("CLK", "Systemtime has been taken from DS3231"); + } } return; }