@@ -1147,19 +1147,17 @@ boolean SFE_UBLOX_GPS::isConnected(uint16_t maxWait)
1147
1147
if (commType == COMM_TYPE_I2C)
1148
1148
{
1149
1149
_i2cPort->beginTransmission ((uint8_t )_gpsI2Caddress);
1150
- return _i2cPort->endTransmission () == 0 ;
1150
+ if (_i2cPort->endTransmission () != 0 )
1151
+ return false ; // Sensor did not ack
1151
1152
}
1152
- else if (commType == COMM_TYPE_SERIAL)
1153
- {
1154
- // Query navigation rate to see whether we get a meaningful response
1155
- packetCfg.cls = UBX_CLASS_CFG;
1156
- packetCfg.id = UBX_CFG_RATE;
1157
- packetCfg.len = 0 ;
1158
- packetCfg.startingSpot = 0 ;
1159
1153
1160
- return (sendCommand (&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_RECEIVED); // We are polling the RATE so we expect data and an ACK
1161
- }
1162
- return false ;
1154
+ // Query navigation rate to see whether we get a meaningful response
1155
+ packetCfg.cls = UBX_CLASS_CFG;
1156
+ packetCfg.id = UBX_CFG_RATE;
1157
+ packetCfg.len = 0 ;
1158
+ packetCfg.startingSpot = 0 ;
1159
+
1160
+ return (sendCommand (&packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_RECEIVED); // We are polling the RATE so we expect data and an ACK
1163
1161
}
1164
1162
1165
1163
// Given a message, calc and store the two byte "8-Bit Fletcher" checksum over the entirety of the message
@@ -2012,17 +2010,17 @@ boolean SFE_UBLOX_GPS::setSurveyMode(uint8_t mode, uint16_t observationTime, flo
2012
2010
packetCfg.payload [x] = 0 ;
2013
2011
2014
2012
// payloadCfg should be loaded with poll response. Now modify only the bits we care about
2015
- payloadCfg[2 ] = mode; // Set mode. Survey-In and Disabled are most common. Use ECEF (not LAT/LON/ALT).
2013
+ payloadCfg[2 ] = mode; // Set mode. Survey-In and Disabled are most common. Use ECEF (not LAT/LON/ALT).
2016
2014
2017
2015
// svinMinDur is U4 (uint32_t) but we'll only use a uint16_t (waiting more than 65535 seconds seems excessive!)
2018
2016
payloadCfg[24 ] = observationTime & 0xFF ; // svinMinDur in seconds
2019
2017
payloadCfg[25 ] = observationTime >> 8 ; // svinMinDur in seconds
2020
- payloadCfg[26 ] = 0 ; // Truncate to 16 bits
2021
- payloadCfg[27 ] = 0 ; // Truncate to 16 bits
2018
+ payloadCfg[26 ] = 0 ; // Truncate to 16 bits
2019
+ payloadCfg[27 ] = 0 ; // Truncate to 16 bits
2022
2020
2023
2021
// svinAccLimit is U4 (uint32_t) in 0.1mm.
2024
2022
uint32_t svinAccLimit = (uint32_t )(requiredAccuracy * 10000.0 ); // Convert m to 0.1mm
2025
- payloadCfg[28 ] = svinAccLimit & 0xFF ; // svinAccLimit in 0.1mm increments
2023
+ payloadCfg[28 ] = svinAccLimit & 0xFF ; // svinAccLimit in 0.1mm increments
2026
2024
payloadCfg[29 ] = svinAccLimit >> 8 ;
2027
2025
payloadCfg[30 ] = svinAccLimit >> 16 ;
2028
2026
payloadCfg[31 ] = svinAccLimit >> 24 ;
@@ -2079,7 +2077,7 @@ boolean SFE_UBLOX_GPS::getSurveyStatus(uint16_t maxWait)
2079
2077
uint32_t tempFloat = extractLong (28 );
2080
2078
svin.meanAccuracy = ((float )tempFloat) / 10000.0 ; // Convert 0.1mm to m
2081
2079
2082
- svin.valid = payloadCfg[36 ]; // 1 if survey-in position is valid, 0 otherwise
2080
+ svin.valid = payloadCfg[36 ]; // 1 if survey-in position is valid, 0 otherwise
2083
2081
svin.active = payloadCfg[37 ]; // 1 if survey-in in progress, 0 otherwise
2084
2082
2085
2083
return (true );
0 commit comments