From 9d5a1a8106450ed482aca54ec3b54e68a13eba04 Mon Sep 17 00:00:00 2001 From: ted Date: Tue, 19 Nov 2019 15:54:50 -0800 Subject: [PATCH 1/2] allow TimeOfWeek to be sourced from basic NAV HPPOS isn't necessary to get the iTOW, which is a nice substitute for both a generic epoch and a 'time since last valid communication' from the library (because of #40 and #46). --- src/SparkFun_Ublox_Arduino_Library.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/SparkFun_Ublox_Arduino_Library.cpp b/src/SparkFun_Ublox_Arduino_Library.cpp index 9194776..889c901 100644 --- a/src/SparkFun_Ublox_Arduino_Library.cpp +++ b/src/SparkFun_Ublox_Arduino_Library.cpp @@ -601,6 +601,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) //Parse various byte fields into global vars constexpr int startingSpot = 0; //fixed value used in processUBX + timeOfWeek = extractLong(0); gpsMillisecond = extractLong(0) % 1000; //Get last three digits of iTOW gpsYear = extractInt(4); gpsMonth = extractByte(6); @@ -655,7 +656,6 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) verticalAccuracy = extractLong(32); highResModuleQueried.all = true; - highResModuleQueried.timeOfWeek = true; highResModuleQueried.highResLatitude = true; highResModuleQueried.highResLongitude = true; highResModuleQueried.elipsoid = true; @@ -663,6 +663,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) highResModuleQueried.geoidSeparation = true; highResModuleQueried.horizontalAccuracy = true; highResModuleQueried.verticalAccuracy = true; + moduleQueried.timeOfWeek = true; // this can arrive here too. if (_printDebug == true) { @@ -1781,12 +1782,13 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait) uint32_t SFE_UBLOX_GPS::getTimeOfWeek(uint16_t maxWait /* = 250*/) { - if (highResModuleQueried.timeOfWeek == false) - getHPPOSLLH(); - highResModuleQueried.timeOfWeek = false; //Since we are about to give this to user, mark this data as stale + if (moduleQueried.gpsiTOW == false) + getPVT(); + moduleQueried.gpsiTOW = false; //Since we are about to give this to user, mark this data as stale return (timeOfWeek); } + int32_t SFE_UBLOX_GPS::getHighResLatitude(uint16_t maxWait /* = 250*/) { if (highResModuleQueried.highResLatitude == false) From fbd6af75de3198a3cc82272f4056b6d6ecfbc9ac Mon Sep 17 00:00:00 2001 From: ted Date: Tue, 19 Nov 2019 16:22:49 -0800 Subject: [PATCH 2/2] correct var name --- src/SparkFun_Ublox_Arduino_Library.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SparkFun_Ublox_Arduino_Library.cpp b/src/SparkFun_Ublox_Arduino_Library.cpp index 889c901..1102644 100644 --- a/src/SparkFun_Ublox_Arduino_Library.cpp +++ b/src/SparkFun_Ublox_Arduino_Library.cpp @@ -663,7 +663,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg) highResModuleQueried.geoidSeparation = true; highResModuleQueried.horizontalAccuracy = true; highResModuleQueried.verticalAccuracy = true; - moduleQueried.timeOfWeek = true; // this can arrive here too. + moduleQueried.gpsiTOW = true; // this can arrive via HPPOS too. if (_printDebug == true) {