From 4dc8af3a1b5943f1f083894b0445837e4c816b42 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 19 Feb 2020 20:02:57 -0800 Subject: [PATCH] trust gps time across deep sleep --- src/GPS.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GPS.cpp b/src/GPS.cpp index e59b45c51..e8fe51fc3 100644 --- a/src/GPS.cpp +++ b/src/GPS.cpp @@ -7,7 +7,8 @@ HardwareSerial _serial_gps(GPS_SERIAL_NUM); uint32_t timeStartMsec; // Once we have a GPS lock, this is where we hold the initial msec clock that corresponds to that time uint64_t zeroOffsetSecs; // GPS based time in secs since 1970 - only updated once on initial lock -bool timeSetFromGPS; // We only reset our time once per wake + +RTC_DATA_ATTR bool timeSetFromGPS; // We only reset our time once per _boot_ after that point just run from the internal clock (even across sleeps) GPS gps; @@ -32,7 +33,7 @@ void GPS::readFromRTC() { uint32_t now = millis(); - DEBUG_MSG("Read RTC time as %ld (cur millis %u)\n", tv.tv_sec, now); + DEBUG_MSG("Read RTC time as %ld (cur millis %u) valid=%d\n", tv.tv_sec, now, timeSetFromGPS); timeStartMsec = now; zeroOffsetSecs = tv.tv_sec; }