@@ -1027,8 +1027,9 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
1027
1027
1028
1028
fixType = extractByte (20 - startingSpot);
1029
1029
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
1031
1031
carrierSolution = extractByte (21 - startingSpot) >> 6 ; // Get 6th&7th bits of this byte
1032
+ headVehValid = (extractByte (21 - startingSpot) >> 5 ) & 0x1 ; // Get the 5th bit
1032
1033
SIV = extractByte (23 - startingSpot);
1033
1034
longitude = extractSignedLong (24 - startingSpot);
1034
1035
latitude = extractSignedLong (28 - startingSpot);
@@ -1039,10 +1040,15 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
1039
1040
nedNorthVel = extractSignedLong (48 - startingSpot);
1040
1041
nedEastVel = extractSignedLong (52 - startingSpot);
1041
1042
nedDownVel = extractSignedLong (56 - startingSpot);
1042
-
1043
1043
groundSpeed = extractSignedLong (60 - startingSpot);
1044
1044
headingOfMotion = extractSignedLong (64 - startingSpot);
1045
+ speedAccEst = extractLong (68 - startingSpot);
1046
+ headingAccEst = extractLong (72 - startingSpot);
1045
1047
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);
1046
1052
1047
1053
// Mark all datums as fresh (not read before)
1048
1054
moduleQueried.gpsiTOW = true ;
@@ -1059,23 +1065,28 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
1059
1065
moduleQueried.all = true ;
1060
1066
moduleQueried.gnssFixOk = true ;
1061
1067
moduleQueried.diffSoln = true ;
1068
+ moduleQueried.headVehValid = true ;
1062
1069
moduleQueried.longitude = true ;
1063
1070
moduleQueried.latitude = true ;
1064
1071
moduleQueried.altitude = true ;
1065
1072
moduleQueried.altitudeMSL = true ;
1066
-
1067
1073
moduleQueried.horizontalAccEst = true ;
1068
1074
moduleQueried.verticalAccEst = true ;
1069
1075
moduleQueried.nedNorthVel = true ;
1070
1076
moduleQueried.nedEastVel = true ;
1071
1077
moduleQueried.nedDownVel = true ;
1072
-
1073
1078
moduleQueried.SIV = true ;
1074
1079
moduleQueried.fixType = true ;
1075
1080
moduleQueried.carrierSolution = true ;
1076
1081
moduleQueried.groundSpeed = true ;
1077
1082
moduleQueried.headingOfMotion = true ;
1083
+ moduleQueried.speedAccEst = true ;
1084
+ moduleQueried.headingAccEst = true ;
1078
1085
moduleQueried.pDOP = true ;
1086
+ moduleQueried.invalidLlh = true ;
1087
+ moduleQueried.headVeh = true ;
1088
+ moduleQueried.magDec = true ;
1089
+ moduleQueried.magAcc = true ;
1079
1090
}
1080
1091
else if (msg->id == UBX_NAV_HPPOSLLH && msg->len == 36 )
1081
1092
{
@@ -3111,6 +3122,19 @@ uint16_t SFE_UBLOX_GPS::extractInt(uint8_t spotToStart)
3111
3122
return (val);
3112
3123
}
3113
3124
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
+
3114
3138
// Given a spot, extract a byte from the payload
3115
3139
uint8_t SFE_UBLOX_GPS::extractByte (uint8_t spotToStart)
3116
3140
{
@@ -3195,6 +3219,54 @@ bool SFE_UBLOX_GPS::getTimeValid(uint16_t maxWait)
3195
3219
return (gpsTimeValid);
3196
3220
}
3197
3221
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
+
3198
3270
// Get the current millisecond
3199
3271
uint16_t SFE_UBLOX_GPS::getMillisecond (uint16_t maxWait)
3200
3272
{
@@ -3780,6 +3852,18 @@ uint8_t SFE_UBLOX_GPS::getCarrierSolutionType(uint16_t maxWait)
3780
3852
return (carrierSolution);
3781
3853
}
3782
3854
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
+
3783
3867
// Get the ground speed in mm/s
3784
3868
int32_t SFE_UBLOX_GPS::getGroundSpeed (uint16_t maxWait)
3785
3869
{
@@ -3901,6 +3985,7 @@ void SFE_UBLOX_GPS::flushPVT()
3901
3985
moduleQueried.all = false ;
3902
3986
moduleQueried.gnssFixOk = false ;
3903
3987
moduleQueried.diffSoln = false ;
3988
+ moduleQueried.headVehValid = false ;
3904
3989
moduleQueried.longitude = false ;
3905
3990
moduleQueried.latitude = false ;
3906
3991
moduleQueried.altitude = false ;
@@ -3910,7 +3995,13 @@ void SFE_UBLOX_GPS::flushPVT()
3910
3995
moduleQueried.carrierSolution = false ;
3911
3996
moduleQueried.groundSpeed = false ;
3912
3997
moduleQueried.headingOfMotion = false ;
3998
+ moduleQueried.speedAccEst = false ;
3999
+ moduleQueried.headingAccEst = false ;
3913
4000
moduleQueried.pDOP = false ;
4001
+ moduleQueried.invalidLlh = false ;
4002
+ moduleQueried.headVeh = false ;
4003
+ moduleQueried.magDec = false ;
4004
+ moduleQueried.magAcc = false ;
3914
4005
}
3915
4006
3916
4007
// Mark all the HPPOSLLH data as read/stale. This is handy to get data alignment after CRC failure
0 commit comments