Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Firmware/RTK_Everywhere/GNSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ void gnssFirmwareBeginUpdate()
serialGNSS->begin(serialBaud, SERIAL_8N1, pin_GnssUart_RX, pin_GnssUart_TX);

// Echo everything to/from GNSS
while (1)
task.endDirectConnectMode = false;
while (!task.endDirectConnectMode)
{
static unsigned long lastSerial = millis(); // Temporary fix for buttonless Flex

Expand All @@ -356,7 +357,7 @@ void gnssFirmwareBeginUpdate()
if (serialGNSS->available()) // Note: use if, not while
Serial.write(serialGNSS->read());

// Button task will gnssFirmwareRemoveUpdate and restart
// Button task will set task.endDirectConnectMode true

// Temporary fix for buttonless Flex. TODO - remove
if ((productVariant == RTK_FLEX) && ((millis() - lastSerial) > 30000))
Expand All @@ -378,6 +379,13 @@ void gnssFirmwareBeginUpdate()
ESP.restart();
}
}

// Remove all the special file. See #763 . Do the file removal in the loop
gnssFirmwareRemoveUpdate();

systemFlush(); // Complete prints

ESP.restart();
}

//----------------------------------------
Expand Down
14 changes: 11 additions & 3 deletions Firmware/RTK_Everywhere/GNSS_UM980.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,8 @@ void um980FirmwareBeginUpdate()
bool inBootMode = false;

// Echo everything to/from UM980
while (1)
task.endDirectConnectMode = false;
while (!task.endDirectConnectMode)
{
// Data coming from UM980 to external USB
if (serialGNSS->available()) // Note: use if, not while
Expand Down Expand Up @@ -2129,8 +2130,15 @@ void um980FirmwareBeginUpdate()
}
}

// Button task will um980FirmwareRemoveUpdate and restart
// Button task will set task.endDirectConnectMode true
}

// Remove the special file. See #763 . Do the file removal in the loop
um980FirmwareRemoveUpdate();

systemFlush(); // Complete prints

ESP.restart();
}

//----------------------------------------
Expand All @@ -2146,7 +2154,7 @@ bool um980FirmwareCheckUpdate()
//----------------------------------------
void um980FirmwareRemoveUpdate()
{
return gnssFirmwareRemoveUpdateFile("/updateUm980Firmware.txt");
gnssFirmwareRemoveUpdateFile("/updateUm980Firmware.txt");
}

//----------------------------------------
12 changes: 10 additions & 2 deletions Firmware/RTK_Everywhere/LoRa.ino
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,8 @@ void beginLoraFirmwareUpdate()

// Push any incoming ESP32 UART0 to UART1 or UART2 and vice versa
// Infinite loop until button is pressed
while (1)
task.endDirectConnectMode = false;
while (!task.endDirectConnectMode)
{
static unsigned long lastSerial = millis(); // Temporary fix for buttonless Flex

Expand All @@ -567,7 +568,7 @@ void beginLoraFirmwareUpdate()
if (serialGNSS->available()) // Note: use if, not while
Serial.write(serialGNSS->read());

// Button task will removeUpdateLoraFirmware and restart
// Button task will set task.endDirectConnectMode true

// Temporary fix for buttonless Flex. TODO - remove
if ((productVariant == RTK_FLEX) && ((millis() - lastSerial) > 30000))
Expand All @@ -589,6 +590,13 @@ void beginLoraFirmwareUpdate()
ESP.restart();
}
}

// Remove the special file. See #763 . Do the file removal in the loop
removeUpdateLoraFirmware();

systemFlush(); // Complete prints

ESP.restart();
}

void loraSetupTransmit()
Expand Down
8 changes: 2 additions & 6 deletions Firmware/RTK_Everywhere/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2077,15 +2077,11 @@ void buttonCheckTask(void *e)
delay(300);
beepOff();

// Remove all the special files
removeUpdateLoraFirmware();
um980FirmwareRemoveUpdate();
gnssFirmwareRemoveUpdate();

systemPrintln("Exiting direct connection (passthrough) mode");
systemFlush(); // Complete prints

ESP.restart();
// See #763 . Do the file removal in the loop
task.endDirectConnectMode = true; // Indicate to loop that direct connection should be ended
}
}
// Torch is a special case. Handle tilt stop and web config mode
Expand Down
2 changes: 2 additions & 0 deletions Firmware/RTK_Everywhere/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,8 @@ struct struct_tasks
bool sdSizeCheckTaskStopRequest = false;
bool updatePplTaskStopRequest = false;
bool updateWebServerTaskStopRequest = false;

volatile bool endDirectConnectMode = false; // Set true by e.g. button task
} task;

#ifdef COMPILE_NETWORK
Expand Down