Skip to content

Commit 9d5a1a8

Browse files
committed
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 sparkfun#40 and sparkfun#46).
1 parent 0cd8d3c commit 9d5a1a8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/SparkFun_Ublox_Arduino_Library.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
601601
//Parse various byte fields into global vars
602602
constexpr int startingSpot = 0; //fixed value used in processUBX
603603

604+
timeOfWeek = extractLong(0);
604605
gpsMillisecond = extractLong(0) % 1000; //Get last three digits of iTOW
605606
gpsYear = extractInt(4);
606607
gpsMonth = extractByte(6);
@@ -655,14 +656,14 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
655656
verticalAccuracy = extractLong(32);
656657

657658
highResModuleQueried.all = true;
658-
highResModuleQueried.timeOfWeek = true;
659659
highResModuleQueried.highResLatitude = true;
660660
highResModuleQueried.highResLongitude = true;
661661
highResModuleQueried.elipsoid = true;
662662
highResModuleQueried.meanSeaLevel = true;
663663
highResModuleQueried.geoidSeparation = true;
664664
highResModuleQueried.horizontalAccuracy = true;
665665
highResModuleQueried.verticalAccuracy = true;
666+
moduleQueried.timeOfWeek = true; // this can arrive here too.
666667

667668
if (_printDebug == true)
668669
{
@@ -1781,12 +1782,13 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
17811782

17821783
uint32_t SFE_UBLOX_GPS::getTimeOfWeek(uint16_t maxWait /* = 250*/)
17831784
{
1784-
if (highResModuleQueried.timeOfWeek == false)
1785-
getHPPOSLLH();
1786-
highResModuleQueried.timeOfWeek = false; //Since we are about to give this to user, mark this data as stale
1785+
if (moduleQueried.gpsiTOW == false)
1786+
getPVT();
1787+
moduleQueried.gpsiTOW = false; //Since we are about to give this to user, mark this data as stale
17871788
return (timeOfWeek);
17881789
}
17891790

1791+
17901792
int32_t SFE_UBLOX_GPS::getHighResLatitude(uint16_t maxWait /* = 250*/)
17911793
{
17921794
if (highResModuleQueried.highResLatitude == false)

0 commit comments

Comments
 (0)