Skip to content

Commit a4e8d67

Browse files
committed
Add lora setting and menu support
1 parent bfcc323 commit a4e8d67

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ void menuMain()
334334

335335
// Change the USB serial output behavior if necessary
336336
forwardGnssDataToUsbSerial = settings.enableGnssToUsbSerial;
337+
338+
// While in LoRa mode, we need to know when the last serial interaction was
339+
loraLastIncomingSerial = millis();
337340
}
338341

339342
// Change system wide settings based on current user profile
@@ -556,7 +559,7 @@ void menuRadio()
556559
systemPrint("1) ESP-NOW Radio: ");
557560
systemPrintf("%s\r\n", settings.enableEspNow ? "Enabled" : "Disabled");
558561
#else // COMPILE_ESPNOW
559-
systemPrintln("1) **ESP-Now Not Compiled**");
562+
systemPrintln("1) **ESP-Now Not Compiled**");
560563
#endif // COMPILE_ESPNOW
561564

562565
if (settings.enableEspNow == true)
@@ -596,12 +599,18 @@ void menuRadio()
596599

597600
if (present.radio_lora == true)
598601
{
599-
systemPrint("10) LoRa Radio: ");
600-
systemPrintf("%s\r\n", settings.enableLora ? "Enabled" : "Disabled");
601-
602-
if (settings.enableLora == true)
602+
if (settings.enableLora == false)
603+
{
604+
systemPrintln("10) LoRa Radio: Disabled");
605+
}
606+
else
603607
{
608+
loraGetVersion();
609+
systemPrintf("10) LoRa Radio: Enabled - Firmware v%s\r\n", loraFirmwareVersion);
604610
systemPrintf("11) LoRa Coordination Frequency: %0.3f\r\n", settings.loraCoordinationFrequency);
611+
systemPrintf("12) Seconds without user serial that must elapse before LoRa radio goes into dedicated "
612+
"listening mode: %d\r\n",
613+
settings.loraSerialInteractionTimeout_s);
605614
}
606615
}
607616

@@ -712,6 +721,12 @@ void menuRadio()
712721
getNewSetting("Enter the frequency used to coordinate radios in MHz", 903.0, 927.0,
713722
&settings.loraCoordinationFrequency);
714723
}
724+
else if (present.radio_lora == true && settings.enableLora == true && incoming == 12)
725+
{
726+
getNewSetting("Enter the number of seconds without user serial that must elapse before LoRa radio goes "
727+
"into dedicated listening mode",
728+
10, 600, &settings.loraSerialInteractionTimeout_s);
729+
}
715730

716731
else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
717732
break;

Firmware/RTK_Everywhere/settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ struct Settings
13801380
bool enableLora = false;
13811381
float loraCoordinationFrequency = 910.000;
13821382
bool debugLora = false;
1383+
int loraSerialInteractionTimeout_s = 30; //Seconds without user serial that must elapse before LoRa radio goes into dedicated listening mode
13831384

13841385
// Add new settings to appropriate group above or create new group
13851386
// Then also add to the same group in rtkSettingsEntries below
@@ -1896,6 +1897,7 @@ const RTK_Settings_Entry rtkSettingsEntries[] =
18961897
{ 0, 1, 1, 0, 0, 0, 0, 1, _bool, 0, & settings.enableLora, "enableLora", },
18971898
{ 0, 1, 1, 0, 0, 0, 0, 1, _float, 3, & settings.loraCoordinationFrequency, "loraCoordinationFrequency", },
18981899
{ 0, 0, 0, 0, 0, 0, 0, 1, _bool, 3, & settings.debugLora, "debugLora", },
1900+
{ 0, 1, 1, 0, 0, 0, 0, 1, _int, 3, & settings.loraSerialInteractionTimeout_s, "loraSerialInteractionTimeout_s", },
18991901

19001902

19011903
// Add new settings to appropriate group above or create new group

0 commit comments

Comments
 (0)