From 11378325e0d2c911d3bd35dbbfafbc6f818268e4 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Tue, 17 Sep 2024 06:29:18 -0500 Subject: [PATCH] Separate GPS and NTP RTCQuality logic and allow GPS time to always set us (#4721) --- src/gps/RTC.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index 42a98f568..728284242 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -124,8 +124,11 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate) } else if (q > currentQuality) { shouldSet = true; LOG_DEBUG("Upgrading time to quality %s\n", RtcName(q)); - } else if (q >= RTCQualityNTP && (now - lastSetMsec) > (12 * 60 * 60 * 1000UL)) { - // Every 12 hrs we will slam in a new GPS or Phone GPS / NTP time, to correct for local RTC clock drift + } else if (q == RTCQualityGPS) { + shouldSet = true; + LOG_DEBUG("Reapplying GPS time: %ld secs\n", printableEpoch); + } else if (q == RTCQualityNTP && (now - lastSetMsec) > (12 * 60 * 60 * 1000UL)) { + // Every 12 hrs we will slam in a new NTP or Phone GPS / NTP time, to correct for local RTC clock drift shouldSet = true; LOG_DEBUG("Reapplying external time to correct clock drift %ld secs\n", printableEpoch); } else {