Dont hammer the bus

This commit is contained in:
jpirnay
2026-04-17 23:21:03 +02:00
parent f68fbc39e4
commit 134527de5f
+7 -6
View File
@@ -545,13 +545,14 @@ void updatePeriodic() {
// DS3231 (if present) has priority, synchronize the system time // DS3231 (if present) has priority, synchronize the system time
// every 10 minutes directly against the RTC, instead of calculating. // every 10 minutes directly against the RTC, instead of calculating.
if (initExternalRTC()) { if (initExternalRTC()) {
time_t rtcTime = readExternalRTC();
unsigned long nowMs = millis(); unsigned long nowMs = millis();
if ((nowMs - lastPeriodicUpdateMs >= PERIODIC_UPDATE_INTERVAL_MS) && if (nowMs - lastPeriodicUpdateMs >= PERIODIC_UPDATE_INTERVAL_MS) {
(rtcTime > 1577836800)) { // Check if time is after 2020 (plausible timestamp) time_t rtcTime = readExternalRTC();
lastPeriodicUpdateMs = nowMs; if (rtcTime > 1577836800) { // Check if time is after 2020 (plausible timestamp)
setSystemClock(rtcTime); lastPeriodicUpdateMs = nowMs;
LOG_DBG("CLK", "Systemtime has been taken from DS3231"); setSystemClock(rtcTime);
LOG_DBG("CLK", "Systemtime has been taken from DS3231");
}
} }
return; return;
} }