@@ -886,6 +886,14 @@ void otaUpdate()
886
886
// machine
887
887
if (otaRequestFirmwareVersionCheck == true )
888
888
{
889
+ if (websocketConnected)
890
+ {
891
+ char newVersionCSV[40 ];
892
+ snprintf (newVersionCSV, sizeof (newVersionCSV), " newFirmwareVersion,%s," ,
893
+ otaReportedVersion);
894
+ sendStringToWebsocket (newVersionCSV);
895
+ }
896
+
889
897
otaUpdateStop ();
890
898
return ;
891
899
}
@@ -897,13 +905,18 @@ void otaUpdate()
897
905
else
898
906
{
899
907
systemPrintln (" Version Check: Firmware is up to date. No new firmware available." );
908
+ if (websocketConnected)
909
+ sendStringToWebsocket ((char *)" newFirmwareVersion,CURRENT," );
910
+
900
911
otaUpdateStop ();
901
912
}
902
913
}
903
914
else
904
915
{
905
916
// Failed to get version number
906
917
systemPrintln (" Failed to get version number from server." );
918
+ if (websocketConnected)
919
+ sendStringToWebsocket ((char *)" newFirmwareVersion,NO_SERVER," );
907
920
otaUpdateStop ();
908
921
}
909
922
break ;
@@ -912,11 +925,21 @@ void otaUpdate()
912
925
case OTA_STATE_UPDATE_FIRMWARE:
913
926
// Determine if the network has failed
914
927
if (!connected)
928
+ {
915
929
otaUpdateStop ();
930
+
931
+ if (websocketConnected)
932
+ sendStringToWebsocket ((char *)" gettingNewFirmware,ERROR," );
933
+ }
916
934
else
917
935
{
918
936
// Perform the firmware update
919
937
otaUpdateFirmware ();
938
+
939
+ // Update triggers ESP.restart(). If we get this far, the firmware update has failed
940
+ if (websocketConnected)
941
+ sendStringToWebsocket ((char *)" gettingNewFirmware,ERROR," );
942
+
920
943
otaUpdateStop ();
921
944
}
922
945
break ;
@@ -927,7 +950,7 @@ void otaUpdate()
927
950
if (PERIODIC_DISPLAY (PD_OTA_STATE))
928
951
{
929
952
char line[30 ];
930
- const char * state;
953
+ const char *state;
931
954
932
955
PERIODIC_CLEAR (PD_OTA_STATE);
933
956
state = otaStateNameGet (otaState, line);
0 commit comments