From fc82e872d6e159c9394f84283f82de5cec156d0a Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 8 Oct 2020 05:23:52 +0800 Subject: [PATCH] don't require gps to have lock before we'll trust GPS time --- docs/software/gps-todo.txt | 3 +++ platformio.ini | 2 +- src/gps/UBloxGPS.cpp | 32 +++++++++++++++----------------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/software/gps-todo.txt b/docs/software/gps-todo.txt index 5dc8c273..ab750d9e 100644 --- a/docs/software/gps-todo.txt +++ b/docs/software/gps-todo.txt @@ -6,6 +6,9 @@ bin/run.sh --set region 8 time only mode ./bin/run.sh --set gps_operation 3 +allow longer locking attempts +allow locking while cpu sleeps +test with crummy antenna ublox parsing failure record power measurements and update spreadsheet diff --git a/platformio.ini b/platformio.ini index b48dc393..504165bc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -62,7 +62,7 @@ lib_deps = 1260 ; OneButton library for non-blocking button debounce 1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib https://github.com/meshtastic/arduino-fsm.git - https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#cb8353dfddd1b0e205098f5e70d5f2a5f74b4838 + https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad https://github.com/meshtastic/RadioLib.git#1083c2e76f9906c5f80dfec726facebf8413eef0 https://github.com/meshtastic/TinyGPSPlus.git https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460 diff --git a/src/gps/UBloxGPS.cpp b/src/gps/UBloxGPS.cpp index 1007162b..ba30935f 100644 --- a/src/gps/UBloxGPS.cpp +++ b/src/gps/UBloxGPS.cpp @@ -138,23 +138,21 @@ void UBloxGPS::whileActive() */ bool UBloxGPS::lookForTime() { - if (fixType >= 2) { - if (ublox.moduleQueried.gpsSecond) { - /* Convert to unix time - The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January - 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). - */ - struct tm t; - t.tm_sec = ublox.getSecond(0); - t.tm_min = ublox.getMinute(0); - t.tm_hour = ublox.getHour(0); - t.tm_mday = ublox.getDay(0); - t.tm_mon = ublox.getMonth(0) - 1; - t.tm_year = ublox.getYear(0) - 1900; - t.tm_isdst = false; - perhapsSetRTC(t); - return true; - } + if (ublox.moduleQueried.gpsSecond) { + /* Convert to unix time + The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January + 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). + */ + struct tm t; + t.tm_sec = ublox.getSecond(0); + t.tm_min = ublox.getMinute(0); + t.tm_hour = ublox.getHour(0); + t.tm_mday = ublox.getDay(0); + t.tm_mon = ublox.getMonth(0) - 1; + t.tm_year = ublox.getYear(0) - 1900; + t.tm_isdst = false; + perhapsSetRTC(t); + return true; } return false;