Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 61e2e2e

Browse files
author
Nathan Seidle
committed
Flash guarding the print statements
This allows this lib to run on Unos.
1 parent eea8369 commit 61e2e2e

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
279279
if (lsb == 0xFF)
280280
{
281281
//I believe this is a Ublox bug. Device should never present an 0xFF.
282-
debugPrintln((char *)"checkUbloxI2C: Ublox bug, no bytes available");
282+
debugPrintln((char *)F("checkUbloxI2C: Ublox bug, no bytes available"));
283283
lastCheck = millis(); //Put off checking to avoid I2C bus traffic
284284
return (false);
285285
}
@@ -288,7 +288,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
288288

289289
if (bytesAvailable == 0)
290290
{
291-
debugPrintln((char *)"checkUbloxI2C: OK, zero bytes available");
291+
debugPrintln((char *)F("checkUbloxI2C: OK, zero bytes available"));
292292
lastCheck = millis(); //Put off checking to avoid I2C bus traffic
293293
return (false);
294294
}
@@ -345,7 +345,7 @@ boolean SFE_UBLOX_GPS::checkUbloxI2C()
345345
{
346346
if (incoming == 0x7F)
347347
{
348-
debugPrintln((char *)"Module not ready with data");
348+
debugPrintln((char *)F("Module not ready with data"));
349349
delay(5); //In logic analyzation, the module starting responding after 1.48ms
350350
goto TRY_AGAIN;
351351
}
@@ -573,9 +573,9 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX)
573573
printPacket(incomingUBX);
574574

575575
if (packetCfg.valid == true)
576-
debugPrintln((char *)"packetCfg now valid");
576+
debugPrintln((char *)F("packetCfg now valid"));
577577
if (packetAck.valid == true)
578-
debugPrintln((char *)"packetAck now valid");
578+
debugPrintln((char *)F("packetAck now valid"));
579579
}
580580

581581
processUBXpacket(incomingUBX); //We've got a valid packet, now do something with it
@@ -592,7 +592,7 @@ void SFE_UBLOX_GPS::processUBX(uint8_t incoming, ubxPacket *incomingUBX)
592592
digitalWrite((uint8_t)checksumFailurePin, HIGH);
593593
}
594594

595-
debugPrint((char *)"Checksum failed:");
595+
debugPrint((char *)F("Checksum failed:"));
596596
_debugSerial->print(F(" checksumA: "));
597597
_debugSerial->print(incomingUBX->checksumA);
598598
_debugSerial->print(F(" checksumB: "));
@@ -640,13 +640,13 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
640640
if (msg->id == UBX_ACK_ACK && msg->payload[0] == packetCfg.cls && msg->payload[1] == packetCfg.id)
641641
{
642642
//The ack we just received matched the CLS/ID of last packetCfg sent (or received)
643-
debugPrintln((char *)"UBX ACK: Command sent/ack'd successfully");
643+
debugPrintln((char *)F("UBX ACK: Command sent/ack'd successfully"));
644644
commandAck = UBX_ACK_ACK;
645645
}
646646
else if (msg->id == UBX_ACK_NACK && msg->payload[0] == packetCfg.cls && msg->payload[1] == packetCfg.id)
647647
{
648648
//The ack we just received matched the CLS/ID of last packetCfg sent
649-
debugPrintln((char *)"UBX ACK: Not-Acknowledged");
649+
debugPrintln((char *)F("UBX ACK: Not-Acknowledged"));
650650
commandAck = UBX_ACK_NACK;
651651
}
652652
break;
@@ -771,7 +771,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t ma
771771
retVal = sendI2cCommand(outgoingUBX, maxWait);
772772
if (retVal != SFE_UBLOX_STATUS_SUCCESS)
773773
{
774-
debugPrintln((char *)"Send I2C Command failed");
774+
debugPrintln((char *)F("Send I2C Command failed"));
775775
return retVal;
776776
}
777777
}
@@ -785,12 +785,12 @@ sfe_ublox_status_e SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t ma
785785
//Depending on what we just sent, either we need to look for an ACK or not
786786
if (outgoingUBX.cls == UBX_CLASS_CFG)
787787
{
788-
debugPrintln((char *)"sendCommand: Waiting for ACK response");
788+
debugPrintln((char *)F("sendCommand: Waiting for ACK response"));
789789
retVal = waitForACKResponse(outgoingUBX.cls, outgoingUBX.id, maxWait); //Wait for Ack response
790790
}
791791
else
792792
{
793-
debugPrintln((char *)"sendCommand: Waiting for No ACK response");
793+
debugPrintln((char *)F("sendCommand: Waiting for No ACK response"));
794794
retVal = waitForNoACKResponse(outgoingUBX.cls, outgoingUBX.id, maxWait); //Wait for Ack response
795795
}
796796
}
@@ -1025,21 +1025,21 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(uint8_t requestedClass, uin
10251025
else
10261026
{
10271027
//Reset packet and continue checking incoming data for matching cls/id
1028-
debugPrintln((char *)"waitForACKResponse: CLS/ID mismatch, continue to wait...");
1028+
debugPrintln((char *)F("waitForACKResponse: CLS/ID mismatch, continue to wait..."));
10291029
packetCfg.valid = false; //This will go true when we receive a response to the packet we sent
10301030
}
10311031
}
10321032
else
10331033
{
10341034
//We were expecting data but didn't get a valid config packet
1035-
debugPrintln((char *)"waitForACKResponse: Invalid config packet");
1035+
debugPrintln((char *)F("waitForACKResponse: Invalid config packet"));
10361036
return (SFE_UBLOX_STATUS_FAIL); //We got an ACK, we're never going to get valid config data
10371037
}
10381038
}
10391039
else
10401040
{
10411041
//We have sent new data. We expect an ACK but no return config packet.
1042-
debugPrintln((char *)"waitForACKResponse: New data successfully sent");
1042+
debugPrintln((char *)F("waitForACKResponse: New data successfully sent"));
10431043
return (SFE_UBLOX_STATUS_DATA_SENT); //New data successfully sent
10441044
}
10451045
}
@@ -1062,7 +1062,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(uint8_t requestedClass, uin
10621062
//Through debug warning, This command might not get an ACK
10631063
if (packetCfg.valid == true)
10641064
{
1065-
debugPrintln((char *)"waitForACKResponse: Config was valid but ACK not received");
1065+
debugPrintln((char *)F("waitForACKResponse: Config was valid but ACK not received"));
10661066
}
10671067

10681068
if (_printDebug == true)
@@ -1106,7 +1106,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForNoACKResponse(uint8_t requestedClass, u
11061106
}
11071107
else
11081108
{
1109-
debugPrintln((char *)"waitForNoACKResponse: CLS/ID match but failed CRC");
1109+
debugPrintln((char *)F("waitForNoACKResponse: CLS/ID match but failed CRC"));
11101110
return (SFE_UBLOX_STATUS_CRC_FAIL); //We got the right packet but it was corrupt
11111111
}
11121112
}
@@ -1115,7 +1115,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForNoACKResponse(uint8_t requestedClass, u
11151115
//Reset packet and continue checking incoming data for matching cls/id
11161116
if (_printDebug == true)
11171117
{
1118-
debugPrint((char *)"waitForNoACKResponse: CLS/ID mismatch: ");
1118+
debugPrint((char *)F("waitForNoACKResponse: CLS/ID mismatch: "));
11191119
_debugSerial->print(F("CLS: "));
11201120
_debugSerial->print(packetCfg.cls, HEX);
11211121
_debugSerial->print(F(" ID: "));
@@ -1681,7 +1681,7 @@ boolean SFE_UBLOX_GPS::setPortOutput(uint8_t portID, uint8_t outStreamSettings,
16811681

16821682
if (commandAck != UBX_ACK_ACK)
16831683
{
1684-
debugPrintln((char *)"setPortOutput failed to ACK");
1684+
debugPrintln((char *)F("setPortOutput failed to ACK"));
16851685
return (false);
16861686
}
16871687

@@ -2072,7 +2072,7 @@ boolean SFE_UBLOX_GPS::powerSaveMode(bool power_save, uint16_t maxWait)
20722072
*/
20732073
if (protVer >= 27)
20742074
{
2075-
debugPrintln((char *)"powerSaveMode (UBX-CFG-RXM) is not supported by this protocol version");
2075+
debugPrintln((char *)F("powerSaveMode (UBX-CFG-RXM) is not supported by this protocol version"));
20762076
return (false);
20772077
}
20782078

@@ -2238,19 +2238,19 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
22382238
if (autoPVT && autoPVTImplicitUpdate)
22392239
{
22402240
//The GPS is automatically reporting, we just check whether we got unread data
2241-
debugPrintln((char *)"getPVT: Autoreporting");
2241+
debugPrintln((char *)F("getPVT: Autoreporting"));
22422242
checkUblox();
22432243
return moduleQueried.all;
22442244
}
22452245
else if (autoPVT && !autoPVTImplicitUpdate)
22462246
{
22472247
//Someone else has to call checkUblox for us...
2248-
debugPrintln((char *)"getPVT: Exit immediately");
2248+
debugPrintln((char *)F("getPVT: Exit immediately"));
22492249
return (false);
22502250
}
22512251
else
22522252
{
2253-
debugPrintln((char *)"getPVT: Polling");
2253+
debugPrintln((char *)F("getPVT: Polling"));
22542254

22552255
//The GPS is not automatically reporting navigation position so we have to poll explicitly
22562256
packetCfg.cls = UBX_CLASS_NAV;

0 commit comments

Comments
 (0)