Skip to content

Commit d913d65

Browse files
committed
Report internet timeout on web config
1 parent 480328c commit d913d65

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Firmware/RTK_Everywhere/menuFirmware.ino

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ const char *otaStateNameGet(uint8_t state, char *string)
793793
void otaUpdate()
794794
{
795795
bool connected;
796+
static uint32_t connectTimer = 0;
796797

797798
// Check if we need a scheduled check
798799
connected = networkConsumerIsConnected(NETCONSUMER_OTA_CLIENT);
@@ -827,6 +828,7 @@ void otaUpdate()
827828
{
828829
// Start the network if necessary
829830
networkConsumerAdd(NETCONSUMER_OTA_CLIENT, NETWORK_ANY, __FILE__, __LINE__);
831+
connectTimer = millis();
830832
otaSetState(OTA_STATE_WAIT_FOR_NETWORK);
831833
}
832834
break;
@@ -847,6 +849,18 @@ void otaUpdate()
847849
networkUserAdd(NETCONSUMER_OTA_CLIENT, __FILE__, __LINE__);
848850
otaSetState(OTA_STATE_GET_FIRMWARE_VERSION);
849851
}
852+
853+
else if ((millis() - connectTimer) > (5 * MILLISECONDS_IN_A_SECOND))
854+
{
855+
// Report failed connection to web client
856+
if (websocketConnected)
857+
{
858+
if (settings.debugFirmwareUpdate)
859+
systemPrintln("Firmware update failed to connect to network");
860+
sendStringToWebsocket((char *)"newFirmwareVersion,NO_INTERNET,");
861+
otaUpdateStop();
862+
}
863+
}
850864
break;
851865

852866
// Get firmware version from server
@@ -883,6 +897,8 @@ void otaUpdate()
883897
// machine
884898
if (otaRequestFirmwareVersionCheck == true)
885899
{
900+
otaRequestFirmwareVersionCheck = false;
901+
886902
if (websocketConnected)
887903
{
888904
char newVersionCSV[40];

0 commit comments

Comments
 (0)