Skip to content

Add get/setNAV5PositionAccuracy #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8197,6 +8197,50 @@ bool SFE_UBLOX_GNSS::setupPowerMode(sfe_ublox_rxm_mode_e mode, uint16_t maxWait)
return sendCommand(&packetCfg, maxWait);
}


// Position Accuracy

// Change the Position Accuracy using UBX-CFG-NAV5
// Value provided in meters
bool SFE_UBLOX_GNSS::setNAV5PositionAccuracy(uint16_t meters, uint16_t maxWait)
{
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_NAV5;
packetCfg.len = 0;
packetCfg.startingSpot = 0;

// Ask module for the current navigation model settings. Loads into payloadCfg.
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return (false);

payloadCfg[0] = 0x10; // mask: set only the posMark
payloadCfg[1] = 0x00; // mask
payloadCfg[18] = meters;

packetCfg.len = 36;
packetCfg.startingSpot = 0;

return (sendCommand(&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
}

// Get the position accuracy using UBX-CFG-NAV5
// Returns meters. 0 if the sendCommand fails
uint16_t SFE_UBLOX_GNSS::getNAV5PositionAccuracy(uint16_t maxWait)
{
packetCfg.cls = UBX_CLASS_CFG;
packetCfg.id = UBX_CFG_NAV5;
packetCfg.len = 0;
packetCfg.startingSpot = 0;

// Ask module for the current navigation model settings. Loads into payloadCfg.
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return 0;

return (payloadCfg[18]);
}



// Dynamic Platform Model

// Change the dynamic platform model using UBX-CFG-NAV5
Expand Down
5 changes: 5 additions & 0 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,11 @@ class SFE_UBLOX_GNSS
bool setDynamicModel(dynModel newDynamicModel = DYN_MODEL_PORTABLE, uint16_t maxWait = defaultMaxWait);
uint8_t getDynamicModel(uint16_t maxWait = defaultMaxWait); // Get the dynamic model - returns 255 if the sendCommand fails

// Change the position accuracy using UBX-CFG-NAV5
bool setNAV5PositionAccuracy(uint16_t meters = 100, uint16_t maxWait = defaultMaxWait);
uint16_t getNAV5PositionAccuracy(uint16_t maxWait = defaultMaxWait); // Get the position accuracy - returns 0 if the sendCommand fails


// Reset / enable / configure the odometer
bool resetOdometer(uint16_t maxWait = defaultMaxWait); // Reset the odometer
bool enableOdometer(bool enable = true, uint16_t maxWait = defaultMaxWait); // Enable / disable the odometer
Expand Down