@@ -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;
@@ -1488,9 +1488,13 @@ boolean SFE_UBLOX_GPS::getPortSettings(uint8_t portID, uint16_t maxWait)
14881488boolean SFE_UBLOX_GPS::setPortOutput (uint8_t portID, uint8_t outStreamSettings, uint16_t maxWait)
14891489{
14901490 // Get the current config values for this port ID
1491- if (getPortSettings (portID) == false )
1491+ if (getPortSettings (portID, maxWait ) == false )
14921492 return (false ); // Something went wrong. Bail.
14931493
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+
14941498 // Yes, this is the depreciated way to do it but it's still supported on v27 so it
14951499 // covers both ZED-F9P (v27) and SAM-M8Q (v18)
14961500
@@ -1512,9 +1516,13 @@ boolean SFE_UBLOX_GPS::setPortInput(uint8_t portID, uint8_t inStreamSettings, ui
15121516{
15131517 // Get the current config values for this port ID
15141518 // This will load the payloadCfg array with current port settings
1515- if (getPortSettings (portID) == false )
1519+ if (getPortSettings (portID, maxWait ) == false )
15161520 return (false ); // Something went wrong. Bail.
15171521
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+
15181526 packetCfg.cls = UBX_CLASS_CFG;
15191527 packetCfg.id = UBX_CFG_PRT;
15201528 packetCfg.len = 20 ;
@@ -1789,6 +1797,36 @@ boolean SFE_UBLOX_GPS::getGeofenceState(geofenceState ¤tGeofenceState, uin
17891797 return (true );
17901798}
17911799
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+
17921830// Given a spot in the payload array, extract four bytes and build a long
17931831uint32_t SFE_UBLOX_GPS::extractLong (uint8_t spotToStart)
17941832{
0 commit comments