@@ -164,15 +164,15 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
164
164
_debugSerial->println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
165
165
}
166
166
167
- sendCommand (packetCfg);
167
+ sendCommand (packetCfg, maxWait );
168
168
}
169
169
170
170
// Changes the I2C address that the Ublox module responds to
171
171
// 0x42 is the default but can be changed with this command
172
172
boolean SFE_UBLOX_GPS::setI2CAddress (uint8_t deviceAddress, uint16_t maxWait)
173
173
{
174
174
// Get the current config values for the I2C port
175
- getPortSettings (COM_PORT_I2C); // This will load the payloadCfg array with current port settings
175
+ getPortSettings (COM_PORT_I2C, maxWait ); // This will load the payloadCfg array with current port settings
176
176
177
177
packetCfg.cls = UBX_CLASS_CFG;
178
178
packetCfg.id = UBX_CFG_PRT;
@@ -1361,7 +1361,7 @@ boolean SFE_UBLOX_GPS::getSurveyMode(uint16_t maxWait)
1361
1361
// Control Survey-In for NEO-M8P
1362
1362
boolean SFE_UBLOX_GPS::setSurveyMode (uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait)
1363
1363
{
1364
- if (getSurveyMode () == false ) // Ask module for the current TimeMode3 settings. Loads into payloadCfg.
1364
+ if (getSurveyMode (maxWait ) == false ) // Ask module for the current TimeMode3 settings. Loads into payloadCfg.
1365
1365
return (false );
1366
1366
1367
1367
packetCfg.cls = UBX_CLASS_CFG;
@@ -1488,9 +1488,13 @@ boolean SFE_UBLOX_GPS::getPortSettings(uint8_t portID, uint16_t maxWait)
1488
1488
boolean SFE_UBLOX_GPS::setPortOutput (uint8_t portID, uint8_t outStreamSettings, uint16_t maxWait)
1489
1489
{
1490
1490
// Get the current config values for this port ID
1491
- if (getPortSettings (portID) == false )
1491
+ if (getPortSettings (portID, maxWait ) == false )
1492
1492
return (false ); // Something went wrong. Bail.
1493
1493
1494
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1495
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1496
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_PRT, 100 ); // But we'll only wait for 100msec max
1497
+
1494
1498
// Yes, this is the depreciated way to do it but it's still supported on v27 so it
1495
1499
// covers both ZED-F9P (v27) and SAM-M8Q (v18)
1496
1500
@@ -1512,9 +1516,13 @@ boolean SFE_UBLOX_GPS::setPortInput(uint8_t portID, uint8_t inStreamSettings, ui
1512
1516
{
1513
1517
// Get the current config values for this port ID
1514
1518
// This will load the payloadCfg array with current port settings
1515
- if (getPortSettings (portID) == false )
1519
+ if (getPortSettings (portID, maxWait ) == false )
1516
1520
return (false ); // Something went wrong. Bail.
1517
1521
1522
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1523
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1524
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_PRT, 100 ); // But we'll only wait for 100msec max
1525
+
1518
1526
packetCfg.cls = UBX_CLASS_CFG;
1519
1527
packetCfg.id = UBX_CFG_PRT;
1520
1528
packetCfg.len = 20 ;
@@ -1789,6 +1797,36 @@ boolean SFE_UBLOX_GPS::getGeofenceState(geofenceState ¤tGeofenceState, uin
1789
1797
return (true );
1790
1798
}
1791
1799
1800
+ // Change the dynamic platform model using UBX-CFG-NAV5
1801
+ // Possible values are:
1802
+ // PORTABLE,STATIONARY,PEDESTRIAN,AUTOMOTIVE,SEA,
1803
+ // AIRBORNE1g,AIRBORNE2g,AIRBORNE4g,WRIST,BIKE
1804
+ // WRIST is not supported in protocol versions less than 18
1805
+ // BIKE is supported in protocol versions 19.2
1806
+ boolean SFE_UBLOX_GPS::setDynamicModel (uint8_t newDynamicModel, uint16_t maxWait)
1807
+ {
1808
+ packetCfg.cls = UBX_CLASS_CFG;
1809
+ packetCfg.id = UBX_CFG_NAV5;
1810
+ packetCfg.len = 0 ;
1811
+ packetCfg.startingSpot = 0 ;
1812
+
1813
+ if (sendCommand (packetCfg, maxWait) == false ) // Ask module for the current navigation model settings. Loads into payloadCfg.
1814
+ return (false );
1815
+
1816
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1817
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1818
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_NAV5, 100 ); // But we'll only wait for 100msec max
1819
+
1820
+ payloadCfg[0 ] = 0x01 ; // mask: set only the dyn bit (0)
1821
+ payloadCfg[1 ] = 0x00 ; // mask
1822
+ payloadCfg[2 ] = newDynamicModel; // dynModel
1823
+
1824
+ packetCfg.len = 36 ;
1825
+ packetCfg.startingSpot = 0 ;
1826
+
1827
+ return (sendCommand (packetCfg, maxWait)); // Wait for ack
1828
+ }
1829
+
1792
1830
// Given a spot in the payload array, extract four bytes and build a long
1793
1831
uint32_t SFE_UBLOX_GPS::extractLong (uint8_t spotToStart)
1794
1832
{
0 commit comments