Skip to content

Commit e4f3e45

Browse files
committed
Add \r to all printfs for better terminal compatibility
1 parent ad172d8 commit e4f3e45

File tree

10 files changed

+67
-69
lines changed

10 files changed

+67
-69
lines changed

Firmware/RTK_Surveyor/Base.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool beginSurveyIn()
8484
return (false);
8585
}
8686

87-
Serial.printf("Survey started. This will run until %d seconds have passed and less than %0.03f meter accuracy is achieved.\n",
87+
Serial.printf("Survey started. This will run until %d seconds have passed and less than %0.03f meter accuracy is achieved.\n\r",
8888
settings.observationSeconds,
8989
settings.observationPositionAccuracy
9090
);
@@ -123,9 +123,9 @@ bool startFixedBase()
123123
long majorEcefZ = settings.fixedEcefZ * 100;
124124
long minorEcefZ = ((settings.fixedEcefZ * 100.0) - majorEcefZ) * 100.0;
125125

126-
// Serial.printf("fixedEcefY (should be -4716808.5807): %0.04f\n", settings.fixedEcefY);
127-
// Serial.printf("major (should be -471680858): %d\n", majorEcefY);
128-
// Serial.printf("minor (should be -7): %d\n", minorEcefY);
126+
// Serial.printf("fixedEcefY (should be -4716808.5807): %0.04f\n\r", settings.fixedEcefY);
127+
// Serial.printf("major (should be -471680858): %d\n\r", majorEcefY);
128+
// Serial.printf("minor (should be -7): %d\n\r", minorEcefY);
129129

130130
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
131131
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
@@ -146,17 +146,17 @@ bool startFixedBase()
146146
int32_t majorAlt = settings.fixedAltitude * 100;
147147
int32_t minorAlt = ((settings.fixedAltitude * 100) - majorAlt) * 100;
148148

149-
// Serial.printf("fixedLong (should be -105.184774720): %0.09f\n", settings.fixedLong);
150-
// Serial.printf("major (should be -1051847747): %lld\n", majorLat);
151-
// Serial.printf("minor (should be -20): %lld\n", minorLat);
149+
// Serial.printf("fixedLong (should be -105.184774720): %0.09f\n\r", settings.fixedLong);
150+
// Serial.printf("major (should be -1051847747): %lld\n\r", majorLat);
151+
// Serial.printf("minor (should be -20): %lld\n\r", minorLat);
152152
//
153-
// Serial.printf("fixedLat (should be 40.090335429): %0.09f\n", settings.fixedLat);
154-
// Serial.printf("major (should be 400903354): %lld\n", majorLong);
155-
// Serial.printf("minor (should be 29): %lld\n", minorLong);
153+
// Serial.printf("fixedLat (should be 40.090335429): %0.09f\n\r", settings.fixedLat);
154+
// Serial.printf("major (should be 400903354): %lld\n\r", majorLong);
155+
// Serial.printf("minor (should be 29): %lld\n\r", minorLong);
156156
//
157-
// Serial.printf("fixedAlt (should be 1560.2284): %0.04f\n", settings.fixedAltitude);
158-
// Serial.printf("major (should be 156022): %ld\n", majorAlt);
159-
// Serial.printf("minor (should be 84): %ld\n", minorAlt);
157+
// Serial.printf("fixedAlt (should be 1560.2284): %0.04f\n\r", settings.fixedAltitude);
158+
// Serial.printf("major (should be 156022): %ld\n\r", majorAlt);
159+
// Serial.printf("minor (should be 84): %ld\n\r", minorAlt);
160160

161161
response = i2cGNSS.setStaticPosition(
162162
majorLat, minorLat,

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,28 +176,24 @@ void updateAccuracyLEDs()
176176

177177
if (f_accuracy <= 0.02)
178178
{
179-
Serial.print(F(" 0.01m LED"));
180179
digitalWrite(positionAccuracyLED_1cm, HIGH);
181180
digitalWrite(positionAccuracyLED_10cm, HIGH);
182181
digitalWrite(positionAccuracyLED_100cm, HIGH);
183182
}
184183
else if (f_accuracy <= 0.100)
185184
{
186-
Serial.print(F(" 0.1m LED"));
187185
digitalWrite(positionAccuracyLED_1cm, LOW);
188186
digitalWrite(positionAccuracyLED_10cm, HIGH);
189187
digitalWrite(positionAccuracyLED_100cm, HIGH);
190188
}
191189
else if (f_accuracy <= 1.0000)
192190
{
193-
Serial.print(F(" 1m LED"));
194191
digitalWrite(positionAccuracyLED_1cm, LOW);
195192
digitalWrite(positionAccuracyLED_10cm, LOW);
196193
digitalWrite(positionAccuracyLED_100cm, HIGH);
197194
}
198195
else if (f_accuracy > 1.0)
199196
{
200-
Serial.print(F(" No LEDs"));
201197
digitalWrite(positionAccuracyLED_1cm, LOW);
202198
digitalWrite(positionAccuracyLED_10cm, LOW);
203199
digitalWrite(positionAccuracyLED_100cm, LOW);

Firmware/RTK_Surveyor/States.ino

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void updateSystemState()
129129
float f_accuracy = accuracy;
130130
f_accuracy = f_accuracy / 10000.0; // Convert the horizontal accuracy (mm * 10^-1) to a float
131131

132-
Serial.printf("Waiting for Horz Accuracy < %0.2f meters: %0.2f\n", settings.surveyInStartingAccuracy, f_accuracy);
132+
Serial.printf("Waiting for Horz Accuracy < %0.2f meters: %0.2f\n\r", settings.surveyInStartingAccuracy, f_accuracy);
133133

134134
if (f_accuracy > 0.0 && f_accuracy < settings.surveyInStartingAccuracy)
135135
{
@@ -175,7 +175,7 @@ void updateSystemState()
175175

176176
if (i2cGNSS.getSurveyInObservationTime() > maxSurveyInWait_s)
177177
{
178-
Serial.printf("Survey-In took more than %d minutes. Returning to rover mode.\n", maxSurveyInWait_s / 60);
178+
Serial.printf("Survey-In took more than %d minutes. Returning to rover mode.\n\r", maxSurveyInWait_s / 60);
179179

180180
resetSurvey();
181181

@@ -193,7 +193,7 @@ void updateSystemState()
193193
//Turn off Bluetooth and turn on WiFi
194194
endBluetooth();
195195

196-
Serial.printf("Connecting to local WiFi: %s\n", settings.wifiSSID);
196+
Serial.printf("Connecting to local WiFi: %s\n\r", settings.wifiSSID);
197197
WiFi.begin(settings.wifiSSID, settings.wifiPW);
198198

199199
radioState = WIFI_ON_NOCONNECTION;
@@ -212,20 +212,21 @@ void updateSystemState()
212212

213213
changeState(STATE_BASE_TEMP_WIFI_CONNECTED);
214214
}
215-
// else
216-
// {
217-
// Serial.print(F("WiFi Status: "));
218-
// switch (wifiStatus) {
219-
// case WL_NO_SHIELD: Serial.println(F("WL_NO_SHIELD")); break;
220-
// case WL_IDLE_STATUS: Serial.println(F("WL_IDLE_STATUS")); break;
221-
// case WL_NO_SSID_AVAIL: Serial.println(F("WL_NO_SSID_AVAIL")); break;
222-
// case WL_SCAN_COMPLETED: Serial.println(F("WL_SCAN_COMPLETED")); break;
223-
// case WL_CONNECTED: Serial.println(F("WL_CONNECTED")); break;
224-
// case WL_CONNECT_FAILED: Serial.println(F("WL_CONNECT_FAILED")); break;
225-
// case WL_CONNECTION_LOST: Serial.println(F("WL_CONNECTION_LOST")); break;
226-
// case WL_DISCONNECTED: Serial.println(F("WL_DISCONNECTED")); break;
227-
// }
228-
// }
215+
else
216+
{
217+
Serial.print(F("WiFi Status: "));
218+
switch (wifiStatus) {
219+
case WL_NO_SHIELD: Serial.println(F("WL_NO_SHIELD")); break;
220+
case WL_IDLE_STATUS: Serial.println(F("WL_IDLE_STATUS")); break;
221+
case WL_NO_SSID_AVAIL: Serial.println(F("WL_NO_SSID_AVAIL")); break;
222+
case WL_SCAN_COMPLETED: Serial.println(F("WL_SCAN_COMPLETED")); break;
223+
case WL_CONNECTED: Serial.println(F("WL_CONNECTED")); break;
224+
case WL_CONNECT_FAILED: Serial.println(F("WL_CONNECT_FAILED")); break;
225+
case WL_CONNECTION_LOST: Serial.println(F("WL_CONNECTION_LOST")); break;
226+
case WL_DISCONNECTED: Serial.println(F("WL_DISCONNECTED")); break;
227+
}
228+
delay(1000);
229+
}
229230
}
230231
break;
231232

@@ -238,15 +239,15 @@ void updateSystemState()
238239
{
239240
changeState(STATE_BASE_TEMP_CASTER_STARTED);
240241

241-
Serial.printf("Connected to %s:%d\n", settings.casterHost, settings.casterPort);
242+
Serial.printf("Connected to %s:%d\n\r", settings.casterHost, settings.casterPort);
242243

243244
const int SERVER_BUFFER_SIZE = 512;
244245
char serverBuffer[SERVER_BUFFER_SIZE];
245246

246247
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP %s/%s\r\n\r\n",
247248
settings.mountPointPW, settings.mountPoint, ntrip_server_name, "App Version 1.0");
248249

249-
//Serial.printf("Sending credentials:\n%s\n", serverBuffer);
250+
//Serial.printf("Sending credentials:\n%s\n\r", serverBuffer);
250251
caster.write(serverBuffer, strlen(serverBuffer));
251252

252253
casterResponseWaitStartTime = millis();
@@ -283,11 +284,11 @@ void updateSystemState()
283284
if (responseSpot == 512 - 1) break;
284285
}
285286
response[responseSpot] = '\0';
286-
//Serial.printf("Caster responded with: %s\n", response);
287+
//Serial.printf("Caster responded with: %s\n\r", response);
287288

288289
if (connectionSuccess == false)
289290
{
290-
Serial.printf("Caster responded with bad news: %s. Are you sure your caster credentials are correct?\n", response);
291+
Serial.printf("Caster responded with bad news: %s. Are you sure your caster credentials are correct?\n\r", response);
291292
changeState(STATE_BASE_TEMP_WIFI_CONNECTED); //Return to previous state
292293
}
293294
else
@@ -348,7 +349,7 @@ void updateSystemState()
348349
//Turn off Bluetooth and turn on WiFi
349350
endBluetooth();
350351

351-
Serial.printf("Connecting to local WiFi: %s", settings.wifiSSID);
352+
Serial.printf("Connecting to local WiFi: %s\n\r", settings.wifiSSID);
352353
WiFi.begin(settings.wifiSSID, settings.wifiPW);
353354

354355
radioState = WIFI_ON_NOCONNECTION;
@@ -370,20 +371,21 @@ void updateSystemState()
370371

371372
changeState(STATE_BASE_FIXED_WIFI_CONNECTED);
372373
}
373-
// else
374-
// {
375-
// Serial.print(F("WiFi Status: "));
376-
// switch (wifiStatus) {
377-
// case WL_NO_SHIELD: Serial.println(F("WL_NO_SHIELD")); break;
378-
// case WL_IDLE_STATUS: Serial.println(F("WL_IDLE_STATUS")); break;
379-
// case WL_NO_SSID_AVAIL: Serial.println(F("WL_NO_SSID_AVAIL")); break;
380-
// case WL_SCAN_COMPLETED: Serial.println(F("WL_SCAN_COMPLETED")); break;
381-
// case WL_CONNECTED: Serial.println(F("WL_CONNECTED")); break;
382-
// case WL_CONNECT_FAILED: Serial.println(F("WL_CONNECT_FAILED")); break;
383-
// case WL_CONNECTION_LOST: Serial.println(F("WL_CONNECTION_LOST")); break;
384-
// case WL_DISCONNECTED: Serial.println(F("WL_DISCONNECTED")); break;
385-
// }
386-
// }
374+
else
375+
{
376+
Serial.print(F("WiFi Status: "));
377+
switch (wifiStatus) {
378+
case WL_NO_SHIELD: Serial.println(F("WL_NO_SHIELD")); break;
379+
case WL_IDLE_STATUS: Serial.println(F("WL_IDLE_STATUS")); break;
380+
case WL_NO_SSID_AVAIL: Serial.println(F("WL_NO_SSID_AVAIL")); break;
381+
case WL_SCAN_COMPLETED: Serial.println(F("WL_SCAN_COMPLETED")); break;
382+
case WL_CONNECTED: Serial.println(F("WL_CONNECTED")); break;
383+
case WL_CONNECT_FAILED: Serial.println(F("WL_CONNECT_FAILED")); break;
384+
case WL_CONNECTION_LOST: Serial.println(F("WL_CONNECTION_LOST")); break;
385+
case WL_DISCONNECTED: Serial.println(F("WL_DISCONNECTED")); break;
386+
}
387+
delay(1000);
388+
}
387389
}
388390
break;
389391

@@ -396,15 +398,15 @@ void updateSystemState()
396398
{
397399
changeState(STATE_BASE_FIXED_CASTER_STARTED);
398400

399-
Serial.printf("Connected to %s:%d\n", settings.casterHost, settings.casterPort);
401+
Serial.printf("Connected to %s:%d\n\r", settings.casterHost, settings.casterPort);
400402

401403
const int SERVER_BUFFER_SIZE = 512;
402404
char serverBuffer[SERVER_BUFFER_SIZE];
403405

404406
snprintf(serverBuffer, SERVER_BUFFER_SIZE, "SOURCE %s /%s\r\nSource-Agent: NTRIP %s/%s\r\n\r\n",
405407
settings.mountPointPW, settings.mountPoint, ntrip_server_name, "App Version 1.0");
406408

407-
//Serial.printf("Sending credentials:\n%s\n", serverBuffer);
409+
//Serial.printf("Sending credentials:\n%s\n\r", serverBuffer);
408410
caster.write(serverBuffer, strlen(serverBuffer));
409411

410412
casterResponseWaitStartTime = millis();
@@ -442,7 +444,7 @@ void updateSystemState()
442444
if (responseSpot == 512 - 1) break;
443445
}
444446
response[responseSpot] = '\0';
445-
//Serial.printf("Caster responded with: %s\n", response);
447+
//Serial.printf("Caster responded with: %s\n\r", response);
446448

447449
if (connectionSuccess == false)
448450
{
@@ -547,7 +549,7 @@ void changeState(SystemState newState)
547549
Serial.println(F("State: Base-Fixed - Caster Connected"));
548550
break;
549551
default:
550-
Serial.printf("State Unknown: %d\n", systemState);
552+
Serial.printf("State Unknown: %d\n\r", systemState);
551553
break;
552554
}
553555
}

Firmware/RTK_Surveyor/System.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void checkBatteryLevels()
560560
ledcWrite(ledGreenChannel, 0);
561561
}
562562

563-
Serial.printf("%s\n", tempStr);
563+
Serial.printf("%s\n\r", tempStr);
564564
}
565565

566566
//Ping an I2C device and see if it responds

Firmware/RTK_Surveyor/begin.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void beginSD()
2525
int maxTries = 2;
2626
for ( ; tries < maxTries ; tries++)
2727
{
28-
Serial.printf("SD init failed. Trying again %d out of %d\n", tries + 1, maxTries);
28+
Serial.printf("SD init failed. Trying again %d out of %d\n\r", tries + 1, maxTries);
2929

3030
delay(250); //Give SD more time to power up, then try again
3131
if (sd.begin(SD_CONFIG) == true) break;

Firmware/RTK_Surveyor/menuFirmware.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void menuFirmware()
2020

2121
for (int x = 0 ; x < binCount ; x++)
2222
{
23-
Serial.printf("%d) Load %s\n", x + 1, binFileNames[x]);
23+
Serial.printf("%d) Load %s\n\r", x + 1, binFileNames[x]);
2424
}
2525

2626
Serial.println(F("x) Exit"));
@@ -38,7 +38,7 @@ void menuFirmware()
3838
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
3939
break;
4040
else
41-
Serial.printf("Bad value: %d\n", incoming);
41+
Serial.printf("Bad value: %d\n\r", incoming);
4242
}
4343

4444
while (Serial.available()) Serial.read(); //Empty buffer of any newline chars
@@ -83,7 +83,7 @@ void scanForFirmware()
8383
strcpy(binFileNames[binCount++], fname); //Add this to the array
8484
}
8585
else
86-
Serial.printf("Unknown: %s\n", fname);
86+
Serial.printf("Unknown: %s\n\r", fname);
8787
}
8888
}
8989
tempFile.close();
@@ -102,7 +102,7 @@ void updateFromSD(char *firmwareFileName)
102102
//Wait a long time, this is important
103103
if (xSemaphoreTake(xFATSemaphore, 10000) == pdPASS)
104104
{
105-
Serial.printf("Loading %s\n", firmwareFileName);
105+
Serial.printf("Loading %s\n\r", firmwareFileName);
106106
if (sd.exists(firmwareFileName))
107107
{
108108
SdFile firmwareFile;

Firmware/RTK_Surveyor/menuLog.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void beginLogging()
212212
// O_WRITE - open for write
213213
if (ubxFile.open(fileName, O_CREAT | O_APPEND | O_WRITE) == false)
214214
{
215-
Serial.printf("Failed to create GNSS UBX data file: %s\n", fileName);
215+
Serial.printf("Failed to create GNSS UBX data file: %s\n\r", fileName);
216216
delay(1000);
217217
online.logging = false;
218218
xSemaphoreGive(xFATSemaphore);
@@ -232,7 +232,7 @@ void beginLogging()
232232
return;
233233
}
234234

235-
Serial.printf("Log file created: %s\n", fileName);
235+
Serial.printf("Log file created: %s\n\r", fileName);
236236
online.logging = true;
237237
}
238238
else

Firmware/RTK_Surveyor/menuTest.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ void menuTest()
4949
{
5050
if (settings.enableSD && online.microSD)
5151
{
52-
Serial.println(F("Files found (date time size name):\n"));
52+
Serial.println(F("Files found (date time size name):\n\r"));
5353
sd.ls(LS_R | LS_DATE | LS_SIZE);
5454

55-
// Serial.println(F("Files found (name size):\n"));
55+
// Serial.println(F("Files found (name size):\n\r"));
5656
// File root = SD.open("/"); //Open root
5757
// File file = root.openNextFile();
5858
// while (file) {

Firmware/RTK_Surveyor/nvm.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void recordSystemSettings()
4949
{
5050
while (1) //Hard freeze
5151
{
52-
Serial.printf("Size of settings is %d bytes\n", sizeof(settings));
52+
Serial.printf("Size of settings is %d bytes\n\r", sizeof(settings));
5353
Serial.println(F("Increase the EEPROM footprint!"));
5454
delay(1000);
5555
}

Firmware/RTK_Surveyor/tasks.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void F9PSerialWriteTask(void *e)
2727
}
2828
else
2929
{
30-
Serial.printf("I heard: %c\n", SerialBT.read());
30+
Serial.printf("I heard: %c\n\r", SerialBT.read());
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)