Skip to content

Commit fe8eecc

Browse files
committed
Correct LoRa passthrough mux control
1 parent 36a7c50 commit fe8eecc

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

Firmware/RTK_Everywhere/LoRa.ino

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,12 @@ void muxSelectUm980()
291291
digitalWrite(pin_muxA, LOW); // Connect ESP UART1 to UM980
292292
}
293293

294+
//Used during firmware updates
295+
void muxSelectLoRaUart0()
296+
{
297+
digitalWrite(pin_muxA, HIGH); // Connect ESP UART1 to LoRa UART0
298+
}
299+
294300
void muxSelectUsb()
295301
{
296302
pinMode(pin_muxB, OUTPUT); // Make really sure we can control this pin
@@ -404,6 +410,17 @@ bool forceLoRaPassthrough()
404410

405411
void beginLoraFirmwareUpdate()
406412
{
413+
systemPrintln();
414+
systemPrintln("Entering STM32 direct connect for firmware update. Disconnect this terminal connection. Use "
415+
"'STM32CubeProgrammer' to update the "
416+
"firmware. Baudrate: 57600bps. Parity: None. RTS/DTR: High. Press the power button to return "
417+
"to normal operation.");
418+
419+
systemFlush(); // Complete prints
420+
421+
loraPowerOn();
422+
delay(500); // Allow power to stabilize
423+
407424
// Change Serial speed of UART0
408425
Serial.end(); // We must end before we begin otherwise the UART settings are corrupted
409426
Serial.begin(57600); // Keep this at slower rate
@@ -413,18 +430,8 @@ void beginLoraFirmwareUpdate()
413430

414431
serialGNSS->begin(115200, SERIAL_8N1, pin_GnssUart_RX, pin_GnssUart_TX); // Keep this at 115200
415432

416-
// If the radio is off, turn it on
417-
if (digitalRead(pin_loraRadio_power) == LOW)
418-
{
419-
systemPrintln("Turning on radio");
420-
loraPowerOn();
421-
delay(500); // Allow power to stablize
422-
}
423-
424-
systemFlush(); // Complete prints
425-
426433
// Make sure ESP-UART1 is connected to LoRA STM32 UART0
427-
muxSelectLoRa();
434+
muxSelectLoRaUart0();
428435

429436
loraEnterBootloader(); // Push boot pin high and reset STM32
430437

@@ -433,14 +440,6 @@ void beginLoraFirmwareUpdate()
433440
while (Serial.available())
434441
Serial.read();
435442

436-
systemPrintln();
437-
systemPrintln("Entering STM32 direct connect for firmware update. Disconnect this terminal connection. Use "
438-
"'STM32CubeProgrammer' to update the "
439-
"firmware. Baudrate: 57600bps. Parity: None. RTS/DTR: High. Press the power button to return "
440-
"to normal operation.");
441-
442-
systemFlush(); // Complete prints
443-
444443
// Push any incoming ESP32 UART0 to UART1 and vice versa
445444
// Infinite loop until button is pressed
446445
while (1)
@@ -459,20 +458,16 @@ void beginLoraFirmwareUpdate()
459458
// Remove file and reset to exit LoRa update pass-through mode
460459
removeUpdateLoraFirmware();
461460

462-
// Beep if we are not locally compiled or a release candidate
463-
if (ENABLE_DEVELOPER == false)
464-
{
465-
beepOn();
466-
delay(300);
467-
beepOff();
468-
delay(100);
469-
beepOn();
470-
delay(300);
471-
beepOff();
472-
}
461+
// Beep to indicate exit
462+
beepOn();
463+
delay(300);
464+
beepOff();
465+
delay(100);
466+
beepOn();
467+
delay(300);
468+
beepOff();
473469

474470
systemPrintln("Exiting LoRa Firmware update mode");
475-
476471
systemFlush(); // Complete prints
477472

478473
ESP.restart();

Firmware/RTK_Everywhere/menuSystem.ino

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,8 @@ void menuDebugHardware()
589589
if (forceLoRaPassthrough() == true)
590590
{
591591
systemPrintln();
592-
systemPrintln("Passthrough mode has been recorded to LittleFS. Device will now reset. Wait for Bluetooth LED to blink before attempting STM32 communication.");
593-
594-
delay(50); // Complete prints
592+
systemPrintln("Passthrough mode has been recorded to LittleFS. Device will now reset.");
593+
systemFlush(); // Complete prints
595594

596595
ESP.restart();
597596
}

0 commit comments

Comments
 (0)