Skip to content

Commit

Permalink
trust gps time across deep sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksville committed Feb 20, 2020
1 parent b943835 commit 4dc8af3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 4dc8af3

Please sign in to comment.