@@ -793,6 +793,7 @@ const char *otaStateNameGet(uint8_t state, char *string)
793
793
void otaUpdate ()
794
794
{
795
795
bool connected;
796
+ static uint32_t connectTimer = 0 ;
796
797
797
798
// Check if we need a scheduled check
798
799
connected = networkConsumerIsConnected (NETCONSUMER_OTA_CLIENT);
@@ -827,6 +828,7 @@ void otaUpdate()
827
828
{
828
829
// Start the network if necessary
829
830
networkConsumerAdd (NETCONSUMER_OTA_CLIENT, NETWORK_ANY, __FILE__, __LINE__);
831
+ connectTimer = millis ();
830
832
otaSetState (OTA_STATE_WAIT_FOR_NETWORK);
831
833
}
832
834
break ;
@@ -847,6 +849,18 @@ void otaUpdate()
847
849
networkUserAdd (NETCONSUMER_OTA_CLIENT, __FILE__, __LINE__);
848
850
otaSetState (OTA_STATE_GET_FIRMWARE_VERSION);
849
851
}
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
+ }
850
864
break ;
851
865
852
866
// Get firmware version from server
@@ -883,6 +897,8 @@ void otaUpdate()
883
897
// machine
884
898
if (otaRequestFirmwareVersionCheck == true )
885
899
{
900
+ otaRequestFirmwareVersionCheck = false ;
901
+
886
902
if (websocketConnected)
887
903
{
888
904
char newVersionCSV[40 ];
0 commit comments