Skip to content

Commit 9da7dd3

Browse files
committed
Add initial LoRa settings
1 parent e9dd0be commit 9da7dd3

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ void menuDebugHardware()
462462
systemPrint("16) Print LoRa Debugging: ");
463463
systemPrintf("%s\r\n", settings.debugLora ? "Enabled" : "Disabled");
464464

465+
if (present.radio_lora)
466+
systemPrintln("17) STM32 direct connect");
467+
465468
systemPrintln("e) Erase LittleFS");
466469

467470
systemPrintln("t) Test Screen");
@@ -581,6 +584,47 @@ void menuDebugHardware()
581584
{
582585
settings.debugLora ^= 1;
583586
}
587+
else if (incoming == 17 && present.radio_lora)
588+
{
589+
// Note: STM32 bootloading is not stable above 57600bps
590+
591+
// Stop all UART1 tasks
592+
tasksStopGnssUart();
593+
594+
// If the radio is off, turn it on
595+
if (digitalRead(pin_loraRadio_power) == LOW)
596+
{
597+
systemPrintln("Turning on radio");
598+
loraPowerOn();
599+
delay(500); // Allow power to stablize
600+
}
601+
602+
systemPrintln("Entering STM32 direct connect for firmware update. Use STM32CubeProgrammer to update the "
603+
"firmware. Baudrate: 57600bps. Parity: None. RTS/DTR: High. Power cycle RTK Torch to return "
604+
"to normal operation.");
605+
606+
// Make sure ESP-UART1 is connected to LoRA STM32 UART0
607+
muxSelectLora();
608+
609+
// Change Serial speed of UART0
610+
Serial.begin(57600);
611+
612+
serialGNSS->begin(115200, SERIAL_8N1, pin_GnssUart_RX,
613+
pin_GnssUart_TX); // Make sure UART1 is at 115200 for the STM32 comm
614+
615+
loraEnterBootloader(); // Push boot pin high and reset STM32
616+
617+
// Push any incoming ESP32 UART0 to UART1 and vice versa
618+
while (1)
619+
{
620+
while (Serial.available())
621+
serialGNSS->write(Serial.read());
622+
623+
while (serialGNSS->available())
624+
Serial.write(serialGNSS->read());
625+
}
626+
}
627+
584628
else if (incoming == 'e')
585629
{
586630
systemPrintln("Erasing LittleFS and resetting");

Firmware/RTK_Everywhere/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,7 @@ struct struct_online
20052005
bool ppl = false;
20062006
bool batteryCharger = false;
20072007
bool httpClient = false;
2008+
bool loraRadio = false;
20082009
} online;
20092010

20102011
// Monitor which tasks are running.

0 commit comments

Comments
 (0)