Skip to content

Commit 8514674

Browse files
committed
Add config for port baud rates
1 parent d812971 commit 8514674

File tree

7 files changed

+91
-9
lines changed

7 files changed

+91
-9
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
(Done) Base - Enter fixed coordinates, survey-in settings
2929
(Done) Test menu
3030
31+
Configure baud rates of Radio and Data ports
32+
Move RAWX to GNSS menu
33+
Enable/disable NMEA setences
34+
Disable/enable SBAS
35+
Enable various debug outputs sent over BT
36+
3137
*/
3238

3339
const int FIRMWARE_VERSION_MAJOR = 1;
@@ -342,7 +348,6 @@ void updateDisplay()
342348
oled.setCursor(16, 20); //x, y
343349
oled.print(":");
344350
float hpa = myGPS.getHorizontalAccuracy() / 10000.0;
345-
Serial.printf("hpa: %03f\n", hpa);
346351
if (hpa > 30.0)
347352
{
348353
oled.print(">30");
@@ -365,8 +370,15 @@ void updateDisplay()
365370
oled.drawIcon(2, 35, Antenna_Width, Antenna_Height, Antenna, sizeof(Antenna), true);
366371
oled.setCursor(16, 36); //x, y
367372
oled.print(":");
368-
oled.print(myGPS.getSIV());
369373

374+
if (myGPS.getFixType() == 0) //0 = No Fix
375+
{
376+
oled.print("0");
377+
}
378+
else
379+
{
380+
oled.print(myGPS.getSIV());
381+
}
370382

371383
oled.display();
372384
}

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ bool configureUbloxModuleRover()
106106

107107
response &= setNMEASettings(); //Enable high precision NMEA and extended sentences
108108

109-
//Is SBAS causing weird NMEA failures once we are in RTK mode?
110-
//response &= setSBAS(false); //Disable SBAS. Work around for RTK LED not working in v1.13 firmware.
109+
response &= setSBAS(false); //Disable SBAS. Work around for RTK LED not working in v1.13 firmware.
111110

112111
return (response);
113112
}

Firmware/RTK_Surveyor/System.ino

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,16 @@ bool configureUbloxModule()
198198
//response &= myGPS.setAutoPVT(true, false); //Tell the GPS to "send" each solution and the lib not to update stale data implicitly
199199
//response &= myGPS.setAutoPVT(false); //Turn off PVT
200200

201-
if (getSerialRate(COM_PORT_UART1) != 115200)
201+
if (getSerialRate(COM_PORT_UART1) != settings.dataPortBaud)
202202
{
203203
Serial.println("Updating UART1 rate");
204-
myGPS.setSerialRate(115200, COM_PORT_UART1); //Set UART1 to 115200
204+
205+
myGPS.setSerialRate(settings.dataPortBaud, COM_PORT_UART1); //Set UART1 to 115200
205206
}
206-
if (getSerialRate(COM_PORT_UART2) != 57600)
207+
if (getSerialRate(COM_PORT_UART2) != settings.radioPortBaud)
207208
{
208209
Serial.println("Updating UART2 rate");
209-
myGPS.setSerialRate(57600, COM_PORT_UART2); //Set UART2 to 57600 to match SiK telemetry radio firmware default
210+
myGPS.setSerialRate(settings.radioPortBaud, COM_PORT_UART2); //Set UART2 to 57600 to match SiK telemetry radio firmware default
210211
}
211212

212213
if (response == false)

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ void menuMain()
1919

2020
Serial.println(F("3) Configure Base"));
2121

22+
Serial.println(F("4) Configure Ports"));
23+
2224
Serial.println(F("r) Reset all settings to default"));
2325

2426
Serial.println(F("t) Test menu"));
@@ -33,6 +35,8 @@ void menuMain()
3335
menuLog();
3436
else if (incoming == '3')
3537
menuBase();
38+
else if (incoming == '4')
39+
menuPorts();
3640
else if (incoming == 'r')
3741
{
3842
Serial.println(F("\r\nResetting to factory defaults. Press 'y' to confirm:"));
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//Set the baud rates for the radio and data ports
2+
void menuPorts()
3+
{
4+
while (1)
5+
{
6+
Serial.println();
7+
Serial.println(F("Menu: Port Menu"));
8+
9+
Serial.print(F("1) Set serial baud rate for Radio Port: "));
10+
Serial.print(getSerialRate(COM_PORT_UART2));
11+
Serial.println(F(" bps"));
12+
13+
Serial.print(F("2) Set serial baud rate for Data Port: "));
14+
Serial.print(getSerialRate(COM_PORT_UART1));
15+
Serial.println(F(" bps"));
16+
17+
Serial.println(F("x) Exit"));
18+
19+
byte incoming = getByteChoice(30); //Timeout after x seconds
20+
21+
if (incoming == '1')
22+
{
23+
Serial.print(F("Enter baud rate (4800 to 921600) for Radio Port: "));
24+
int newBaud = getNumber(menuTimeout); //Timeout after x seconds
25+
if (newBaud < 4800 || newBaud > 921600)
26+
{
27+
Serial.println(F("Error: baud rate out of range"));
28+
}
29+
else
30+
{
31+
settings.radioPortBaud = newBaud;
32+
myGPS.setSerialRate(newBaud, COM_PORT_UART2); //Set Radio Port
33+
}
34+
}
35+
else if (incoming == '2')
36+
{
37+
Serial.print(F("Enter baud rate (4800 to 921600) for Data Port: "));
38+
int newBaud = getNumber(menuTimeout); //Timeout after x seconds
39+
if (newBaud < 4800 || newBaud > 921600)
40+
{
41+
Serial.println(F("Error: baud rate out of range"));
42+
}
43+
else
44+
{
45+
settings.dataPortBaud = newBaud;
46+
myGPS.setSerialRate(newBaud, COM_PORT_UART1); //Set Data Port
47+
}
48+
}
49+
50+
else if (incoming == 'x')
51+
break;
52+
else if (incoming == STATUS_GETBYTE_TIMEOUT)
53+
break;
54+
else
55+
printUnknown(incoming);
56+
}
57+
58+
while (Serial.available()) Serial.read(); //Empty buffer of any newline chars
59+
}

Firmware/RTK_Surveyor/nvm.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ void recordSystemSettingsToFile()
7676
settingsFile.println("gnssRAWOutput=" + (String)settings.gnssRAWOutput);
7777
settingsFile.println("frequentFileAccessTimestamps=" + (String)settings.frequentFileAccessTimestamps);
7878
settingsFile.println("maxLogTime_minutes=" + (String)settings.maxLogTime_minutes);
79-
8079
settingsFile.println("observationSeconds=" + (String)settings.observationSeconds);
8180
settingsFile.println("observationPositionAccuracy=" + (String)settings.observationPositionAccuracy);
8281
settingsFile.println("fixedBase=" + (String)settings.fixedBase);
@@ -87,6 +86,8 @@ void recordSystemSettingsToFile()
8786
settingsFile.println("fixedLat=" + (String)settings.fixedLat);
8887
settingsFile.println("fixedLong=" + (String)settings.fixedLong);
8988
settingsFile.println("fixedAltitude=" + (String)settings.fixedAltitude);
89+
settingsFile.println("dataPortBaud=" + (String)settings.dataPortBaud);
90+
settingsFile.println("radioPortBaud=" + (String)settings.radioPortBaud);
9091

9192
updateDataFileAccess(&settingsFile); // Update the file access time & date
9293

@@ -252,6 +253,10 @@ bool parseLine(char* str) {
252253
settings.fixedLong = d;
253254
else if (strcmp(settingName, "fixedAltitude") == 0)
254255
settings.fixedAltitude = d;
256+
else if (strcmp(settingName, "dataPortBaud") == 0)
257+
settings.dataPortBaud = d;
258+
else if (strcmp(settingName, "radioPortBaud") == 0)
259+
settings.radioPortBaud = d;
255260

256261
else
257262
Serial.printf("Unknown setting %s on line: %s\r\n", settingName, str);

Firmware/RTK_Surveyor/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ struct struct_settings {
6363
double fixedLat = 0.0;
6464
double fixedLong = 0.0;
6565
double fixedAltitude = 0.0;
66+
uint32_t dataPortBaud = 115200; //Default to 115200bps
67+
uint32_t radioPortBaud = 57600; //Default to 57600bps to support connection to SiK1000 radios
6668
} settings;
6769

6870
//These are the devices on board RTK Surveyor that may be on or offline.

0 commit comments

Comments
 (0)