@@ -164,15 +164,15 @@ void SFE_UBLOX_GPS::setSerialRate(uint32_t baudrate, uint8_t uartPort, uint16_t
164164 _debugSerial->println (((uint32_t )payloadCfg[10 ] << 16 ) | ((uint32_t )payloadCfg[9 ] << 8 ) | payloadCfg[8 ]);
165165 }
166166
167- sendCommand (packetCfg);
167+ sendCommand (packetCfg, maxWait );
168168}
169169
170170// Changes the I2C address that the Ublox module responds to
171171// 0x42 is the default but can be changed with this command
172172boolean SFE_UBLOX_GPS::setI2CAddress (uint8_t deviceAddress, uint16_t maxWait)
173173{
174174 // 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
176176
177177 packetCfg.cls = UBX_CLASS_CFG;
178178 packetCfg.id = UBX_CFG_PRT;
@@ -1361,7 +1361,7 @@ boolean SFE_UBLOX_GPS::getSurveyMode(uint16_t maxWait)
13611361// Control Survey-In for NEO-M8P
13621362boolean SFE_UBLOX_GPS::setSurveyMode (uint8_t mode, uint16_t observationTime, float requiredAccuracy, uint16_t maxWait)
13631363{
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.
13651365 return (false );
13661366
13671367 packetCfg.cls = UBX_CLASS_CFG;
@@ -1449,9 +1449,13 @@ boolean SFE_UBLOX_GPS::getPortSettings(uint8_t portID, uint16_t maxWait)
14491449boolean SFE_UBLOX_GPS::setPortOutput (uint8_t portID, uint8_t outStreamSettings, uint16_t maxWait)
14501450{
14511451 // Get the current config values for this port ID
1452- if (getPortSettings (portID) == false )
1452+ if (getPortSettings (portID, maxWait ) == false )
14531453 return (false ); // Something went wrong. Bail.
14541454
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+
14551459 // Yes, this is the depreciated way to do it but it's still supported on v27 so it
14561460 // covers both ZED-F9P (v27) and SAM-M8Q (v18)
14571461
@@ -1473,9 +1477,13 @@ boolean SFE_UBLOX_GPS::setPortInput(uint8_t portID, uint8_t inStreamSettings, ui
14731477{
14741478 // Get the current config values for this port ID
14751479 // This will load the payloadCfg array with current port settings
1476- if (getPortSettings (portID) == false )
1480+ if (getPortSettings (portID, maxWait ) == false )
14771481 return (false ); // Something went wrong. Bail.
14781482
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+
14791487 packetCfg.cls = UBX_CLASS_CFG;
14801488 packetCfg.id = UBX_CFG_PRT;
14811489 packetCfg.len = 20 ;
@@ -1870,6 +1878,36 @@ boolean SFE_UBLOX_GPS::powerSaveMode(bool power_save, uint16_t maxWait)
18701878 return (sendCommand (packetCfg, maxWait)); // Wait for ack
18711879}
18721880
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+
18731911// Given a spot in the payload array, extract four bytes and build a long
18741912uint32_t SFE_UBLOX_GPS::extractLong (uint8_t spotToStart)
18751913{
0 commit comments