Skip to content

Commit 9153c23

Browse files
committed
Add enableGnssToUsbSerial setting and toggle code in menuSystem
The default value of false causes status and debug messages to be sent to the USB serial port (previous behavior). Setting this value to true stops the USB serial port from outputting status and debug messages and instead the USB serial port outputs GNSS data. Later PRs will implement the behavior described above. This PR introduces the setting, displays the setting upon menuSystem entry and changes to setting.enableGnssToUsbSerial in the operations menu.
1 parent ccfd99c commit 9153c23

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ void menuSystem()
156156
systemPrintf("Filtered by parser: %d NMEA / %d RTCM / %d UBX\r\n", failedParserMessages_NMEA,
157157
failedParserMessages_RTCM, failedParserMessages_UBX);
158158

159+
// Display the USB serial output status
160+
menuSystemDisplayUsbSerialOutput(settings.enableGnssToUsbSerial);
161+
162+
//---------------------------
163+
// Start of menu
164+
//---------------------------
165+
159166
systemPrintln();
160167
systemPrintln("Menu: System");
161168
// Separate the menu from the status
@@ -916,6 +923,9 @@ void menuOperation()
916923
// ZED
917924
systemPrintln("10) Mirror ZED-F9x's UART1 settings to USB");
918925

926+
// USB Serial
927+
systemPrintln("11) Output GNSS data to USB serial");
928+
919929
systemPrintln("---- Interrupts ----");
920930
systemPrint("30) Bluetooth Interrupts Core: ");
921931
systemPrintln(settings.bluetoothInterruptsCore);
@@ -1017,6 +1027,12 @@ void menuOperation()
10171027
systemPrintln(F("USB messages successfully enabled"));
10181028
}
10191029

1030+
else if (incoming == 11)
1031+
{
1032+
settings.enableGnssToUsbSerial ^= 1;
1033+
menuSystemDisplayUsbSerialOutput(settings.enableGnssToUsbSerial);
1034+
}
1035+
10201036
else if (incoming == 30)
10211037
{
10221038
getNewSetting("Not yet implemented! - Enter Core used for Bluetooth Interrupts", 0, 1,
@@ -1069,6 +1085,15 @@ void menuOperation()
10691085
clearBuffer(); // Empty buffer of any newline chars
10701086
}
10711087

1088+
// Display the USB serial output
1089+
void menuSystemDisplayUsbSerialOutput(bool gnssData)
1090+
{
1091+
if (gnssData)
1092+
systemPrintln("USB Serial output is GNSS data");
1093+
else
1094+
systemPrintln("USB Serial output is status and debug messages");
1095+
}
1096+
10721097
// Toggle periodic print message enables
10731098
void menuPeriodicPrint()
10741099
{

Firmware/RTK_Everywhere/settings.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ typedef struct
976976
const uint32_t frequency; // L-Band frequency, Hz, if supported. 0 if not supported
977977
} Regional_Information;
978978

979-
const Regional_Information Regional_Information_Table[] =
979+
const Regional_Information Regional_Information_Table[] =
980980
{
981981
{ "US", "us", { 50.0, 25.0, -60.0, -125.0}, 1556290000 },
982982
{ "EU", "eu", { 72.0, 36.0, 32.0, -11.0}, 1545260000 },
@@ -1323,6 +1323,8 @@ struct Settings
13231323
bool enableEspNow = false;
13241324
uint8_t wifiChannel = 1; //Valid channels are 1 to 14
13251325

1326+
bool enableGnssToUsbSerial = false;
1327+
13261328
// Add new settings above <------------------------------------------------------------>
13271329
// Then also add to rtkSettingsEntries below
13281330

@@ -1625,6 +1627,8 @@ const RTK_Settings_Entry rtkSettingsEntries[] = {
16251627
{ & settings.enableEspNow, "enableEspNow", _bool, 0, false, true, true },
16261628
{ & settings.wifiChannel, "wifiChannel", _uint8_t, 0, false, true, true },
16271629

1630+
{ & settings.enableGnssToUsbSerial, "enableGnssToUsbSerial", _bool, 0, false, true, true },
1631+
16281632
// Add new settings above <------------------------------------------------------------>
16291633
/*
16301634
{ & settings., "", , 0, false, true },

0 commit comments

Comments
 (0)