Skip to content
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

v2.2.27 #225

Merged
merged 10 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ powerOffWithInterrupt KEYWORD2
setDynamicModel KEYWORD2
getDynamicModel KEYWORD2

setNAV5PositionAccuracy KEYWORD2
getNAV5PositionAccuracy KEYWORD2

resetOdometer KEYWORD2
enableOdometer KEYWORD2
getOdometerConfig KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS Arduino Library
version=2.2.26
version=2.2.27
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
Expand Down
50 changes: 48 additions & 2 deletions src/SparkFun_u-blox_GNSS_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8197,6 +8197,53 @@ 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 metres, 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 the posMask, leave other bits unchanged
payloadCfg[18] = metres & 0xFF;
payloadCfg[19] = metres >> 8;

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;


uint16_t pAcc = ((uint16_t)payloadCfg[19]) << 8;
pAcc |= payloadCfg[18];
return (pAcc);
}



// Dynamic Platform Model

// Change the dynamic platform model using UBX-CFG-NAV5
Expand All @@ -8216,8 +8263,7 @@ bool SFE_UBLOX_GNSS::setDynamicModel(dynModel newDynamicModel, uint16_t maxWait)
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return (false);

payloadCfg[0] = 0x01; // mask: set only the dyn bit (0)
payloadCfg[1] = 0x00; // mask
payloadCfg[0] |= 0x01; // mask: set only the dyn bit (0)
payloadCfg[2] = newDynamicModel; // dynModel

packetCfg.len = 36;
Expand Down
4 changes: 4 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,10 @@ 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 metres, 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
Loading