Skip to content

Commit eb31fa3

Browse files
committed
Fix a few places where non zero error codes were mistakenly...
being treated as "true for success"
1 parent 368b20a commit eb31fa3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: src/SparkFun_Ublox_Arduino_Library.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ boolean SFE_UBLOX_GPS::isConnected()
941941
packetCfg.len = 0;
942942
packetCfg.startingSpot = 0;
943943

944-
return sendCommand(packetCfg);
944+
return sendCommand(packetCfg) == SFE_UBLOX_STATUS_DATA_SENT;
945945
}
946946
return false;
947947
}
@@ -1208,7 +1208,7 @@ boolean SFE_UBLOX_GPS::saveConfiguration(uint16_t maxWait)
12081208
packetCfg.payload[4] = 0xFF; //Set any bit in the saveMask field to save current config to Flash and BBR
12091209
packetCfg.payload[5] = 0xFF;
12101210

1211-
if (sendCommand(packetCfg, maxWait) == false)
1211+
if (sendCommand(packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT)
12121212
return (false); //If command send fails then bail
12131213

12141214
return (true);
@@ -1770,7 +1770,7 @@ boolean SFE_UBLOX_GPS::setPortOutput(uint8_t portID, uint8_t outStreamSettings,
17701770
//payloadCfg is now loaded with current bytes. Change only the ones we need to
17711771
payloadCfg[14] = outStreamSettings; //OutProtocolMask LSB - Set outStream bits
17721772

1773-
return (sendCommand(packetCfg, maxWait));
1773+
return (sendCommand(packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT;
17741774
}
17751775

17761776
//Configure a given port to input UBX, NMEA, RTCM3 or a combination thereof
@@ -1841,7 +1841,7 @@ boolean SFE_UBLOX_GPS::setNavigationFrequency(uint8_t navFreq, uint16_t maxWait)
18411841
payloadCfg[0] = measurementRate & 0xFF; //measRate LSB
18421842
payloadCfg[1] = measurementRate >> 8; //measRate MSB
18431843

1844-
return (sendCommand(packetCfg, maxWait));
1844+
return (sendCommand(packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT;
18451845
}
18461846

18471847
//Get the rate at which the module is outputting nav solutions
@@ -1897,7 +1897,7 @@ boolean SFE_UBLOX_GPS::setAutoPVT(boolean enable, boolean implicitUpdate, uint16
18971897
payloadCfg[1] = UBX_NAV_PVT;
18981898
payloadCfg[2] = enable ? 1 : 0; // rate relative to navigation freq.
18991899

1900-
bool ok = sendCommand(packetCfg, maxWait);
1900+
bool ok = sendCommand(packetCfg, maxWait) == SFE_UBLOX_STATUS_DATA_SENT;
19011901
if (ok)
19021902
{
19031903
autoPVT = enable;
@@ -2196,7 +2196,7 @@ boolean SFE_UBLOX_GPS::setDynamicModel(dynModel newDynamicModel, uint16_t maxWai
21962196
packetCfg.len = 36;
21972197
packetCfg.startingSpot = 0;
21982198

2199-
return (sendCommand(packetCfg, maxWait)); //Wait for ack
2199+
return (sendCommand(packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT; //Wait for ack
22002200
}
22012201

22022202
//Given a spot in the payload array, extract four bytes and build a long

0 commit comments

Comments
 (0)