@@ -8197,6 +8197,53 @@ bool SFE_UBLOX_GNSS::setupPowerMode(sfe_ublox_rxm_mode_e mode, uint16_t maxWait)
8197
8197
return sendCommand(&packetCfg, maxWait);
8198
8198
}
8199
8199
8200
+
8201
+ // Position Accuracy
8202
+
8203
+ // Change the Position Accuracy using UBX-CFG-NAV5
8204
+ // Value provided in meters
8205
+ bool SFE_UBLOX_GNSS::setNAV5PositionAccuracy(uint16_t metres, uint16_t maxWait)
8206
+ {
8207
+ packetCfg.cls = UBX_CLASS_CFG;
8208
+ packetCfg.id = UBX_CFG_NAV5;
8209
+ packetCfg.len = 0;
8210
+ packetCfg.startingSpot = 0;
8211
+
8212
+ // Ask module for the current navigation model settings. Loads into payloadCfg.
8213
+ if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
8214
+ return (false);
8215
+
8216
+ payloadCfg[0] |= 0x10; // mask: set the posMask, leave other bits unchanged
8217
+ payloadCfg[18] = metres & 0xFF;
8218
+ payloadCfg[19] = metres >> 8;
8219
+
8220
+ packetCfg.len = 36;
8221
+ packetCfg.startingSpot = 0;
8222
+
8223
+ return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
8224
+ }
8225
+
8226
+ // Get the position accuracy using UBX-CFG-NAV5
8227
+ // Returns meters. 0 if the sendCommand fails
8228
+ uint16_t SFE_UBLOX_GNSS::getNAV5PositionAccuracy(uint16_t maxWait)
8229
+ {
8230
+ packetCfg.cls = UBX_CLASS_CFG;
8231
+ packetCfg.id = UBX_CFG_NAV5;
8232
+ packetCfg.len = 0;
8233
+ packetCfg.startingSpot = 0;
8234
+
8235
+ // Ask module for the current navigation model settings. Loads into payloadCfg.
8236
+ if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
8237
+ return 0;
8238
+
8239
+
8240
+ uint16_t pAcc = ((uint16_t)payloadCfg[19]) << 8;
8241
+ pAcc |= payloadCfg[18];
8242
+ return (pAcc);
8243
+ }
8244
+
8245
+
8246
+
8200
8247
// Dynamic Platform Model
8201
8248
8202
8249
// Change the dynamic platform model using UBX-CFG-NAV5
@@ -8216,8 +8263,7 @@ bool SFE_UBLOX_GNSS::setDynamicModel(dynModel newDynamicModel, uint16_t maxWait)
8216
8263
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
8217
8264
return (false);
8218
8265
8219
- payloadCfg[0] = 0x01; // mask: set only the dyn bit (0)
8220
- payloadCfg[1] = 0x00; // mask
8266
+ payloadCfg[0] |= 0x01; // mask: set only the dyn bit (0)
8221
8267
payloadCfg[2] = newDynamicModel; // dynModel
8222
8268
8223
8269
packetCfg.len = 36;
0 commit comments