@@ -1027,8 +1027,9 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
10271027
10281028 fixType = extractByte (20 - startingSpot);
10291029 gnssFixOk = extractByte (21 - startingSpot) & 0x1 ; // Get the 1st bit
1030- diffSoln = extractByte (21 - startingSpot) >> 1 & 0x1 ; // Get the 2nd bit
1030+ diffSoln = ( extractByte (21 - startingSpot) >> 1 ) & 0x1 ; // Get the 2nd bit
10311031 carrierSolution = extractByte (21 - startingSpot) >> 6 ; // Get 6th&7th bits of this byte
1032+ headVehValid = (extractByte (21 - startingSpot) >> 5 ) & 0x1 ; // Get the 5th bit
10321033 SIV = extractByte (23 - startingSpot);
10331034 longitude = extractSignedLong (24 - startingSpot);
10341035 latitude = extractSignedLong (28 - startingSpot);
@@ -1039,10 +1040,15 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
10391040 nedNorthVel = extractSignedLong (48 - startingSpot);
10401041 nedEastVel = extractSignedLong (52 - startingSpot);
10411042 nedDownVel = extractSignedLong (56 - startingSpot);
1042-
10431043 groundSpeed = extractSignedLong (60 - startingSpot);
10441044 headingOfMotion = extractSignedLong (64 - startingSpot);
1045+ speedAccEst = extractLong (68 - startingSpot);
1046+ headingAccEst = extractLong (72 - startingSpot);
10451047 pDOP = extractInt (76 - startingSpot);
1048+ invalidLlh = extractByte (78 - startingSpot) & 0x1 ;
1049+ headVeh = extractSignedLong (84 - startingSpot);
1050+ magDec = extractSignedInt (88 - startingSpot);
1051+ magAcc = extractInt (90 - startingSpot);
10461052
10471053 // Mark all datums as fresh (not read before)
10481054 moduleQueried.gpsiTOW = true ;
@@ -1059,23 +1065,28 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
10591065 moduleQueried.all = true ;
10601066 moduleQueried.gnssFixOk = true ;
10611067 moduleQueried.diffSoln = true ;
1068+ moduleQueried.headVehValid = true ;
10621069 moduleQueried.longitude = true ;
10631070 moduleQueried.latitude = true ;
10641071 moduleQueried.altitude = true ;
10651072 moduleQueried.altitudeMSL = true ;
1066-
10671073 moduleQueried.horizontalAccEst = true ;
10681074 moduleQueried.verticalAccEst = true ;
10691075 moduleQueried.nedNorthVel = true ;
10701076 moduleQueried.nedEastVel = true ;
10711077 moduleQueried.nedDownVel = true ;
1072-
10731078 moduleQueried.SIV = true ;
10741079 moduleQueried.fixType = true ;
10751080 moduleQueried.carrierSolution = true ;
10761081 moduleQueried.groundSpeed = true ;
10771082 moduleQueried.headingOfMotion = true ;
1083+ moduleQueried.speedAccEst = true ;
1084+ moduleQueried.headingAccEst = true ;
10781085 moduleQueried.pDOP = true ;
1086+ moduleQueried.invalidLlh = true ;
1087+ moduleQueried.headVeh = true ;
1088+ moduleQueried.magDec = true ;
1089+ moduleQueried.magAcc = true ;
10791090 }
10801091 else if (msg->id == UBX_NAV_HPPOSLLH && msg->len == 36 )
10811092 {
@@ -3111,6 +3122,19 @@ uint16_t SFE_UBLOX_GPS::extractInt(uint8_t spotToStart)
31113122 return (val);
31123123}
31133124
3125+ // Just so there is no ambiguity about whether a uint16_t will cast to a int16_t correctly...
3126+ int16_t SFE_UBLOX_GPS::extractSignedInt (int8_t spotToStart)
3127+ {
3128+ union // Use a union to convert from uint16_t to int16_t
3129+ {
3130+ uint16_t unsignedInt;
3131+ int16_t signedInt;
3132+ } stSignedInt;
3133+
3134+ stSignedInt.unsignedInt = extractInt (spotToStart);
3135+ return (stSignedInt.signedInt );
3136+ }
3137+
31143138// Given a spot, extract a byte from the payload
31153139uint8_t SFE_UBLOX_GPS::extractByte (uint8_t spotToStart)
31163140{
@@ -3195,6 +3219,54 @@ bool SFE_UBLOX_GPS::getTimeValid(uint16_t maxWait)
31953219 return (gpsTimeValid);
31963220}
31973221
3222+ uint32_t SFE_UBLOX_GPS::getSpeedAccEst (uint16_t maxWait)
3223+ {
3224+ if (moduleQueried.speedAccEst == false )
3225+ getPVT (maxWait);
3226+ moduleQueried.speedAccEst = false ; // Since we are about to give this to user, mark this data as stale
3227+ return (speedAccEst);
3228+ }
3229+
3230+ uint32_t SFE_UBLOX_GPS::getHeadingAccEst (uint16_t maxWait)
3231+ {
3232+ if (moduleQueried.headingAccEst == false )
3233+ getPVT (maxWait);
3234+ moduleQueried.headingAccEst = false ; // Since we are about to give this to user, mark this data as stale
3235+ return (headingAccEst);
3236+ }
3237+
3238+ bool SFE_UBLOX_GPS::getInvalidLlh (uint16_t maxWait)
3239+ {
3240+ if (moduleQueried.invalidLlh == false )
3241+ getPVT (maxWait);
3242+ moduleQueried.invalidLlh = false ; // Since we are about to give this to user, mark this data as stale
3243+ return (invalidLlh);
3244+ }
3245+
3246+ int32_t SFE_UBLOX_GPS::getHeadVeh (uint16_t maxWait)
3247+ {
3248+ if (moduleQueried.headVeh == false )
3249+ getPVT (maxWait);
3250+ moduleQueried.headVeh = false ; // Since we are about to give this to user, mark this data as stale
3251+ return (headVeh);
3252+ }
3253+
3254+ int16_t SFE_UBLOX_GPS::getMagDec (uint16_t maxWait)
3255+ {
3256+ if (moduleQueried.magDec == false )
3257+ getPVT (maxWait);
3258+ moduleQueried.magDec = false ; // Since we are about to give this to user, mark this data as stale
3259+ return (magDec);
3260+ }
3261+
3262+ uint16_t SFE_UBLOX_GPS::getMagAcc (uint16_t maxWait)
3263+ {
3264+ if (moduleQueried.magAcc == false )
3265+ getPVT (maxWait);
3266+ moduleQueried.magAcc = false ; // Since we are about to give this to user, mark this data as stale
3267+ return (magAcc);
3268+ }
3269+
31983270// Get the current millisecond
31993271uint16_t SFE_UBLOX_GPS::getMillisecond (uint16_t maxWait)
32003272{
@@ -3780,6 +3852,18 @@ uint8_t SFE_UBLOX_GPS::getCarrierSolutionType(uint16_t maxWait)
37803852 return (carrierSolution);
37813853}
37823854
3855+ // Get whether head vehicle valid or not
3856+ bool SFE_UBLOX_GPS::getHeadVehValid (uint16_t maxWait)
3857+ {
3858+ if (moduleQueried.headVehValid == false )
3859+ getPVT (maxWait);
3860+ moduleQueried.headVehValid = false ; // Since we are about to give this to user, mark this data as stale
3861+ moduleQueried.all = false ;
3862+
3863+ return (headVehValid);
3864+ }
3865+
3866+
37833867// Get the ground speed in mm/s
37843868int32_t SFE_UBLOX_GPS::getGroundSpeed (uint16_t maxWait)
37853869{
@@ -3901,6 +3985,7 @@ void SFE_UBLOX_GPS::flushPVT()
39013985 moduleQueried.all = false ;
39023986 moduleQueried.gnssFixOk = false ;
39033987 moduleQueried.diffSoln = false ;
3988+ moduleQueried.headVehValid = false ;
39043989 moduleQueried.longitude = false ;
39053990 moduleQueried.latitude = false ;
39063991 moduleQueried.altitude = false ;
@@ -3910,7 +3995,13 @@ void SFE_UBLOX_GPS::flushPVT()
39103995 moduleQueried.carrierSolution = false ;
39113996 moduleQueried.groundSpeed = false ;
39123997 moduleQueried.headingOfMotion = false ;
3998+ moduleQueried.speedAccEst = false ;
3999+ moduleQueried.headingAccEst = false ;
39134000 moduleQueried.pDOP = false ;
4001+ moduleQueried.invalidLlh = false ;
4002+ moduleQueried.headVeh = false ;
4003+ moduleQueried.magDec = false ;
4004+ moduleQueried.magAcc = false ;
39144005}
39154006
39164007// Mark all the HPPOSLLH data as read/stale. This is handy to get data alignment after CRC failure
0 commit comments