Skip to content

Commit d3b8332

Browse files
committed
Move prints to F()
1 parent 0c8c6ab commit d3b8332

File tree

12 files changed

+56
-54
lines changed

12 files changed

+56
-54
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool updateSurveyInStatus()
3636
}
3737
else
3838
{
39-
Serial.print("Waiting for Horz Accuracy < 5 meters: ");
39+
Serial.print(F("Waiting for Horz Accuracy < 5 meters: "));
4040
Serial.print(f_accuracy, 2); // Print the accuracy with 2 decimal places
4141
Serial.println();
4242
}
@@ -274,7 +274,7 @@ bool startFixedBase()
274274

275275
if (response == true)
276276
{
277-
Serial.println("Static Base Started Successfully");
277+
Serial.println(F("Static Base Started Successfully"));
278278
}
279279

280280
return (response);

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void loop()
253253
myGPS.checkUblox(); //Regularly poll to get latest data and any RTCM
254254

255255
//Update Bluetooth LED status
256-
if (bluetoothState == BT_ON_NOCONNECTION)
256+
if (radioState == BT_ON_NOCONNECTION)
257257
{
258258
if (millis() - lastBluetoothLEDBlink > 500)
259259
{
@@ -278,7 +278,7 @@ void loop()
278278
//If we are survey'd in, but switch is rover then disable survey
279279
if (configureUbloxModuleRover() == false)
280280
{
281-
Serial.println("Rover config failed!");
281+
Serial.println(F("Rover config failed!"));
282282
}
283283

284284
digitalWrite(baseStatusLED, LOW);
@@ -290,7 +290,7 @@ void loop()
290290

291291
if (configureUbloxModuleBase() == false)
292292
{
293-
Serial.println("Base config failed!");
293+
Serial.println(F("Base config failed!"));
294294
}
295295

296296
startBluetooth(); //Restart Bluetooth with new name
@@ -363,7 +363,7 @@ void updateDisplay()
363363
oled.drawIcon(45, 0, Battery_3_Width, Battery_3_Height, Battery_3, sizeof(Battery_3), true);
364364

365365
//Bluetooth Address or RSSI
366-
if (bluetoothState == BT_CONNECTED)
366+
if (radioState == BT_CONNECTED)
367367
{
368368
oled.drawIcon(4, 0, BT_Symbol_Width, BT_Symbol_Height, BT_Symbol, sizeof(BT_Symbol), true);
369369
}
@@ -389,7 +389,7 @@ void updateDisplay()
389389
float hpa = myGPS.getHorizontalAccuracy() / 10000.0;
390390
if (hpa > 30.0)
391391
{
392-
oled.print(">30");
392+
oled.print(F(">30"));
393393
}
394394
else if (hpa > 9.9)
395395
{

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ bool updateRoverStatus()
1414
float f_accuracy = accuracy;
1515
f_accuracy = f_accuracy / 10000.0; // Convert from mm * 10^-1 to m
1616

17-
Serial.print("Rover Accuracy (m): ");
17+
Serial.print(F("Rover Accuracy (m): "));
1818
Serial.print(f_accuracy, 4); // Print the accuracy with 4 decimal places
1919

2020
if (f_accuracy <= 0.02)
2121
{
22-
Serial.print(" 0.01m LED");
22+
Serial.print(F(" 0.01m LED"));
2323
digitalWrite(positionAccuracyLED_1cm, HIGH);
2424
digitalWrite(positionAccuracyLED_10cm, HIGH);
2525
digitalWrite(positionAccuracyLED_100cm, HIGH);
2626
}
2727
else if (f_accuracy <= 0.100)
2828
{
29-
Serial.print(" 0.1m LED");
29+
Serial.print(F(" 0.1m LED"));
3030
digitalWrite(positionAccuracyLED_1cm, LOW);
3131
digitalWrite(positionAccuracyLED_10cm, HIGH);
3232
digitalWrite(positionAccuracyLED_100cm, HIGH);
3333
}
3434
else if (f_accuracy <= 1.0000)
3535
{
36-
Serial.print(" 1m LED");
36+
Serial.print(F(" 1m LED"));
3737
digitalWrite(positionAccuracyLED_1cm, LOW);
3838
digitalWrite(positionAccuracyLED_10cm, LOW);
3939
digitalWrite(positionAccuracyLED_100cm, HIGH);
4040
}
4141
else if (f_accuracy > 1.0)
4242
{
43-
Serial.print(" No LEDs");
43+
Serial.print(F(" No LEDs"));
4444
digitalWrite(positionAccuracyLED_1cm, LOW);
4545
digitalWrite(positionAccuracyLED_10cm, LOW);
4646
digitalWrite(positionAccuracyLED_100cm, LOW);
@@ -49,10 +49,10 @@ bool updateRoverStatus()
4949
}
5050
else
5151
{
52-
Serial.print("Rover Accuracy: ");
52+
Serial.print(F("Rover Accuracy: "));
5353
Serial.print(accuracy);
5454
Serial.print(" ");
55-
Serial.print("No lock. SIV: ");
55+
Serial.print(F("No lock. SIV: "));
5656
Serial.print(myGPS.getSIV());
5757
Serial.println();
5858
}

Firmware/RTK_Surveyor/System.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ bool configureUbloxModule()
220220

221221
if (getSerialRate(COM_PORT_UART1) != settings.dataPortBaud)
222222
{
223-
Serial.println("Updating UART1 rate");
223+
Serial.println(F("Updating UART1 rate"));
224224
myGPS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Set UART1 to 115200
225225
}
226226
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud)
227227
{
228-
Serial.println("Updating UART2 rate");
228+
Serial.println(F("Updating UART2 rate"));
229229
myGPS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Set UART2 to 57600 to match SiK telemetry radio firmware default
230230
}
231231

@@ -242,7 +242,7 @@ bool configureUbloxModule()
242242
//Configure for rover mode
243243
if (configureUbloxModuleRover() == false)
244244
{
245-
Serial.println("Rover config failed!");
245+
Serial.println(F("Rover config failed!"));
246246
return (false);
247247
}
248248
}
@@ -251,7 +251,7 @@ bool configureUbloxModule()
251251
//Configure for base mode
252252
if (configureUbloxModuleBase() == false)
253253
{
254-
Serial.println("Base config failed!");
254+
Serial.println(F("Base config failed!"));
255255
return (false);
256256
}
257257
}
@@ -606,17 +606,17 @@ boolean SFE_UBLOX_GPS_ADD::getModuleInfo(uint16_t maxWait)
606606
}
607607

608608
//Call back for when BT connection event happens (connected/disconnect)
609-
//Used for updating the bluetoothState state machine
609+
//Used for updating the radioState state machine
610610
void btCallback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
611611
if (event == ESP_SPP_SRV_OPEN_EVT) {
612-
Serial.println("Client Connected");
613-
bluetoothState = BT_CONNECTED;
612+
Serial.println(F("Client Connected"));
613+
radioState = BT_CONNECTED;
614614
digitalWrite(bluetoothStatusLED, HIGH);
615615
}
616616

617617
if (event == ESP_SPP_CLOSE_EVT ) {
618-
Serial.println("Client disconnected");
619-
bluetoothState = BT_ON_NOCONNECTION;
618+
Serial.println(F("Client disconnected"));
619+
radioState = BT_ON_NOCONNECTION;
620620
digitalWrite(bluetoothStatusLED, LOW);
621621
lastBluetoothLEDBlink = millis();
622622
}

Firmware/RTK_Surveyor/begin.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ void beginDisplay()
5454

5555
oled.setCursor(10, 2); //x, y
5656
oled.setFontType(0); //Set font to smallest
57-
oled.print("SparkFun");
57+
oled.print(F("SparkFun"));
5858

5959
oled.setCursor(21, 13);
6060
oled.setFontType(1);
61-
oled.print("RTK");
61+
oled.print(F("RTK"));
6262

6363
int surveyorTextY = 25;
6464
int surveyorTextX = 2;
@@ -122,16 +122,16 @@ void beginGNSS()
122122
// {
123123
// if (strcmp(myGPS.minfo.extension[1], latestZEDFirmware) != 0)
124124
// {
125-
// Serial.print("The ZED-F9P appears to have outdated firmware. Found: ");
125+
// Serial.print(F("The ZED-F9P appears to have outdated firmware. Found: "));
126126
// Serial.println(myGPS.minfo.extension[1]);
127-
// Serial.print("The Surveyor works best with ");
127+
// Serial.print(F("The Surveyor works best with "));
128128
// Serial.println(latestZEDFirmware);
129-
// Serial.print("Please upgrade using u-center.");
129+
// Serial.print(F("Please upgrade using u-center."));
130130
// Serial.println();
131131
// }
132132
// else
133133
// {
134-
// Serial.println("ZED-F9P firmware is current");
134+
// Serial.println(F("ZED-F9P firmware is current"));
135135
// }
136136
// }
137137

@@ -162,13 +162,13 @@ void beginBT()
162162
SerialBT.register_callback(btCallback);
163163
if (startBluetooth() == false)
164164
{
165-
Serial.println("An error occurred initializing Bluetooth");
166-
bluetoothState = BT_OFF;
165+
Serial.println(F("An error occurred initializing Bluetooth"));
166+
radioState = RADIO_OFF;
167167
digitalWrite(bluetoothStatusLED, LOW);
168168
}
169169
else
170170
{
171-
bluetoothState = BT_ON_NOCONNECTION;
171+
radioState = BT_ON_NOCONNECTION;
172172
digitalWrite(bluetoothStatusLED, HIGH);
173173
lastBluetoothLEDBlink = millis();
174174
}

Firmware/RTK_Surveyor/menuBase.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ void menuBase()
2121
{
2222
Serial.print(F("3) Set ECEF X/Y/Z coordinates: "));
2323
Serial.print(settings.fixedEcefX, 4);
24-
Serial.print("m, ");
24+
Serial.print(F("m, "));
2525
Serial.print(settings.fixedEcefY, 4);
26-
Serial.print("m, ");
26+
Serial.print(F("m, "));
2727
Serial.print(settings.fixedEcefZ, 4);
2828
Serial.println(F("m"));
2929
}
3030
else if (settings.fixedBaseCoordinateType == COORD_TYPE_GEOGRAPHIC)
3131
{
3232
Serial.print(F("3) Set Lat/Long/Altitude coordinates: "));
3333
Serial.print(settings.fixedLat, 9);
34-
Serial.print("°, ");
34+
Serial.print(F("°, "));
3535
Serial.print(settings.fixedLong, 9);
36-
Serial.print("°, ");
36+
Serial.print(F("°, "));
3737
Serial.print(settings.fixedAltitude, 4);
3838
Serial.println(F("m"));
3939
}

Firmware/RTK_Surveyor/menuFirmware.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void menuFirmware()
88

99
if (binCount == 0)
1010
{
11-
Serial.println("No valid binary files found.");
11+
Serial.println(F("No valid binary files found."));
1212
delay(2000);
1313
return;
1414
}
@@ -137,7 +137,7 @@ void updateFromSD(char *firmwareFileName)
137137
{
138138
//Advance the bar
139139
barWidth++;
140-
Serial.print("\n[");
140+
Serial.print(F("\n["));
141141
for (int x = 0 ; x < barWidth ; x++)
142142
Serial.print("=");
143143
Serial.printf("%d%%", bytesWritten * 100 / updateSize);

Firmware/RTK_Surveyor/menuLog.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void menuLog()
99
Serial.println(F("Menu: Logging Menu"));
1010

1111
if (settings.enableSD && online.microSD)
12-
Serial.println("microSD card is detected");
12+
Serial.println(F("microSD card is detected"));
1313
else
1414
{
1515
beginSD(); //Test if SD is present
@@ -105,7 +105,7 @@ void beginDataLogging()
105105
}
106106
else
107107
{
108-
Serial.println("beginDataLogging: No date/time available. No file created.");
108+
Serial.println(F("beginDataLogging: No date/time available. No file created."));
109109
online.dataLogging = false;
110110
return;
111111
}

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ void menuMain()
77
Serial.println();
88
Serial.printf("SparkFun RTK Surveyor v%d.%d\r\n", FIRMWARE_VERSION_MAJOR, FIRMWARE_VERSION_MINOR);
99

10-
Serial.print("** Bluetooth broadcasting as: ");
10+
Serial.print(F("** Bluetooth broadcasting as: "));
1111
Serial.print(deviceName);
12-
Serial.println(" **");
12+
Serial.println(F(" **"));
1313

1414
Serial.println(F("Menu: Main Menu"));
1515

Firmware/RTK_Surveyor/menuTest.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ void menuTest()
1414
Serial.println();
1515
Serial.println(F("Menu: Test Menu"));
1616

17-
Serial.print("Bluetooth broadcasting as: ");
17+
Serial.print(F("Bluetooth broadcasting as: "));
1818
Serial.println(deviceName);
1919

20-
Serial.println("Radio Port is now outputting RTCM");
20+
Serial.println(F("Radio Port is now outputting RTCM"));
2121

2222
if (settings.enableSD && online.microSD)
2323
{
24-
Serial.println("microSD card is successfully detected");
24+
Serial.println(F("microSD card is successfully detected"));
2525
}
2626

2727
//0x3D is default on Qwiic board
2828
if (isConnected(0x3D) == true || isConnected(0x3C) == true)
29-
Serial.println("Qwiic Good. Display detected.");
29+
Serial.println(F("Qwiic Good. Display detected."));
3030
else
31-
Serial.println("Qwiic port failed! No display detected.");
31+
Serial.println(F("Qwiic port failed! No display detected."));
3232

3333
Serial.println(F("Any character received over Blueooth connection will be displayed here"));
3434

@@ -52,7 +52,7 @@ void menuTest()
5252
break;
5353
else if (incoming == STATUS_GETBYTE_TIMEOUT)
5454
{
55-
Serial.println("time out");
55+
Serial.println(F("time out"));
5656
// break;
5757
}
5858
else

0 commit comments

Comments
 (0)