@@ -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;
@@ -1449,9 +1449,13 @@ boolean SFE_UBLOX_GPS::getPortSettings(uint8_t portID, uint16_t maxWait)
1449
1449
boolean SFE_UBLOX_GPS::setPortOutput (uint8_t portID, uint8_t outStreamSettings, uint16_t maxWait)
1450
1450
{
1451
1451
// Get the current config values for this port ID
1452
- if (getPortSettings (portID) == false )
1452
+ if (getPortSettings (portID, maxWait ) == false )
1453
1453
return (false ); // Something went wrong. Bail.
1454
1454
1455
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1456
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1457
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_PRT, 100 ); // But we'll only wait for 100msec max
1458
+
1455
1459
// Yes, this is the depreciated way to do it but it's still supported on v27 so it
1456
1460
// covers both ZED-F9P (v27) and SAM-M8Q (v18)
1457
1461
@@ -1473,9 +1477,13 @@ boolean SFE_UBLOX_GPS::setPortInput(uint8_t portID, uint8_t inStreamSettings, ui
1473
1477
{
1474
1478
// Get the current config values for this port ID
1475
1479
// This will load the payloadCfg array with current port settings
1476
- if (getPortSettings (portID) == false )
1480
+ if (getPortSettings (portID, maxWait ) == false )
1477
1481
return (false ); // Something went wrong. Bail.
1478
1482
1483
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1484
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1485
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_PRT, 100 ); // But we'll only wait for 100msec max
1486
+
1479
1487
packetCfg.cls = UBX_CLASS_CFG;
1480
1488
packetCfg.id = UBX_CFG_PRT;
1481
1489
packetCfg.len = 20 ;
@@ -1870,6 +1878,36 @@ boolean SFE_UBLOX_GPS::powerSaveMode(bool power_save, uint16_t maxWait)
1870
1878
return (sendCommand (packetCfg, maxWait)); // Wait for ack
1871
1879
}
1872
1880
1881
+ // Change the dynamic platform model using UBX-CFG-NAV5
1882
+ // Possible values are:
1883
+ // PORTABLE,STATIONARY,PEDESTRIAN,AUTOMOTIVE,SEA,
1884
+ // AIRBORNE1g,AIRBORNE2g,AIRBORNE4g,WRIST,BIKE
1885
+ // WRIST is not supported in protocol versions less than 18
1886
+ // BIKE is supported in protocol versions 19.2
1887
+ boolean SFE_UBLOX_GPS::setDynamicModel (uint8_t newDynamicModel, uint16_t maxWait)
1888
+ {
1889
+ packetCfg.cls = UBX_CLASS_CFG;
1890
+ packetCfg.id = UBX_CFG_NAV5;
1891
+ packetCfg.len = 0 ;
1892
+ packetCfg.startingSpot = 0 ;
1893
+
1894
+ if (sendCommand (packetCfg, maxWait) == false ) // Ask module for the current navigation model settings. Loads into payloadCfg.
1895
+ return (false );
1896
+
1897
+ // Let's make sure we wait for the ACK too (sendCommand will have returned as soon as the module sent its response)
1898
+ // This is only required because we are doing two sendCommands in quick succession using the same class and ID
1899
+ waitForResponse (UBX_CLASS_CFG, UBX_CFG_NAV5, 100 ); // But we'll only wait for 100msec max
1900
+
1901
+ payloadCfg[0 ] = 0x01 ; // mask: set only the dyn bit (0)
1902
+ payloadCfg[1 ] = 0x00 ; // mask
1903
+ payloadCfg[2 ] = newDynamicModel; // dynModel
1904
+
1905
+ packetCfg.len = 36 ;
1906
+ packetCfg.startingSpot = 0 ;
1907
+
1908
+ return (sendCommand (packetCfg, maxWait)); // Wait for ack
1909
+ }
1910
+
1873
1911
// Given a spot in the payload array, extract four bytes and build a long
1874
1912
uint32_t SFE_UBLOX_GPS::extractLong (uint8_t spotToStart)
1875
1913
{
0 commit comments