Skip to content

Commit a06eaca

Browse files
committed
Add get/setNAV5PositionAccuracy
1 parent f8047a5 commit a06eaca

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8197,6 +8197,50 @@ bool SFE_UBLOX_GNSS::setupPowerMode(sfe_ublox_rxm_mode_e mode, uint16_t maxWait)
81978197
return sendCommand(&packetCfg, maxWait);
81988198
}
81998199

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 meters, 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 only the posMark
8217+
payloadCfg[1] = 0x00; // mask
8218+
payloadCfg[18] = meters;
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+
return (payloadCfg[18]);
8240+
}
8241+
8242+
8243+
82008244
// Dynamic Platform Model
82018245

82028246
// Change the dynamic platform model using UBX-CFG-NAV5

src/SparkFun_u-blox_GNSS_Arduino_Library.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,11 @@ class SFE_UBLOX_GNSS
950950
bool setDynamicModel(dynModel newDynamicModel = DYN_MODEL_PORTABLE, uint16_t maxWait = defaultMaxWait);
951951
uint8_t getDynamicModel(uint16_t maxWait = defaultMaxWait); // Get the dynamic model - returns 255 if the sendCommand fails
952952

953+
// Change the position accuracy using UBX-CFG-NAV5
954+
bool setNAV5PositionAccuracy(uint16_t meters = 100, uint16_t maxWait = defaultMaxWait);
955+
uint16_t getNAV5PositionAccuracy(uint16_t maxWait = defaultMaxWait); // Get the position accuracy - returns 0 if the sendCommand fails
956+
957+
953958
// Reset / enable / configure the odometer
954959
bool resetOdometer(uint16_t maxWait = defaultMaxWait); // Reset the odometer
955960
bool enableOdometer(bool enable = true, uint16_t maxWait = defaultMaxWait); // Enable / disable the odometer

0 commit comments

Comments
 (0)