@@ -581,8 +581,15 @@ void otaDisplayPercentage(int bytesWritten, int totalLength, bool alwaysDisplay)
581581 if (bytesWritten == totalLength)
582582 systemPrintln (" ]" );
583583
584+ // Display progress on the display
584585 displayFirmwareUpdateProgress (percent);
585586
587+ // Report progress over the BLE Command Channel
588+ char stringPercent[5 ];
589+ snprintf (stringPercent, sizeof (stringPercent), " %d" , percent);
590+ commandSendStringOkResponse ((char *)" SPEXE" , (char *)" UPDATEPROGRESS" , stringPercent);
591+
592+ // Report progress to the Web Config socket
586593 if (apConfigFirmwareUpdateInProcess == true )
587594 {
588595 char myProgress[50 ];
@@ -819,7 +826,7 @@ void otaUpdate()
819826 otaUpdateStop ();
820827 break ;
821828
822- // Wait for a request from a user or from the scheduler
829+ // Wait for a request from a user, the Web Config, CLI, or from the scheduler
823830 case OTA_STATE_OFF:
824831 if (otaRequestFirmwareVersionCheck || otaRequestFirmwareUpdate)
825832 {
@@ -849,14 +856,31 @@ void otaUpdate()
849856
850857 else if ((millis () - connectTimer) > (10 * MILLISECONDS_IN_A_SECOND))
851858 {
852- // Report failed connection to web client
859+ if (settings.debugFirmwareUpdate )
860+ systemPrintln (" Firmware update failed to connect to network" );
861+
862+ // If we are connected to the Web Config or BLE CLI, then we assume the user
863+ // is requesting the firmware update via those interfaces, thus we attempt an update
864+ // only once, stopping the state machine on failure
865+
853866 if (websocketConnected)
854867 {
855- if (settings.debugFirmwareUpdate )
856- systemPrintln (" Firmware update failed to connect to network" );
868+ // Report failed connection to web client
857869 sendStringToWebsocket ((char *)" newFirmwareVersion,NO_INTERNET," );
858870 otaUpdateStop ();
859871 }
872+
873+ if (bluetoothCommandIsConnected ())
874+ {
875+ // Report failure to the CLI
876+ if (otaRequestFirmwareUpdate)
877+ commandSendExecuteErrorResponse ((char *)" SPEXE" , (char *)" UPDATEFIRMWARE" , (char *)" No Internet" );
878+ else if (otaRequestFirmwareVersionCheck)
879+ commandSendErrorResponse ((char *)" SPGET" , (char *)" rtkRemoteFirmwareVersion" , (char *)" No Internet" );
880+ otaUpdateStop ();
881+ }
882+
883+
860884 }
861885 break ;
862886
@@ -904,6 +928,12 @@ void otaUpdate()
904928 sendStringToWebsocket (newVersionCSV);
905929 }
906930
931+ if (bluetoothCommandIsConnected ())
932+ {
933+ // Report value over the CLI
934+ commandSendStringResponse ((char *)" SPGET" , (char *)" rtkRemoteVersion" , otaReportedVersion);
935+ }
936+
907937 otaUpdateStop ();
908938 return ;
909939 }
@@ -927,6 +957,12 @@ void otaUpdate()
927957 systemPrintln (" Failed to get version number from server." );
928958 if (websocketConnected)
929959 sendStringToWebsocket ((char *)" newFirmwareVersion,NO_SERVER," );
960+
961+ // Report failure over the CLI
962+ if (bluetoothCommandIsConnected ())
963+ commandSendExecuteErrorResponse ((char *)" SPGET" , (char *)" rtkRemoteFimrwareVersion" ,
964+ (char *)" No Server" );
965+
930966 otaUpdateStop ();
931967 }
932968 break ;
@@ -940,6 +976,11 @@ void otaUpdate()
940976
941977 if (websocketConnected)
942978 sendStringToWebsocket ((char *)" gettingNewFirmware,ERROR," );
979+
980+ // Report failure over the CLI
981+ if (bluetoothCommandIsConnected ())
982+ commandSendExecuteErrorResponse ((char *)" SPEXE" , (char *)" UPDATEFIRMWARE" ,
983+ (char *)" Connection Error" );
943984 }
944985 else
945986 {
@@ -950,6 +991,10 @@ void otaUpdate()
950991 if (websocketConnected)
951992 sendStringToWebsocket ((char *)" gettingNewFirmware,ERROR," );
952993
994+ // Report failure over the CLI
995+ if (bluetoothCommandIsConnected ())
996+ commandSendExecuteErrorResponse ((char *)" SPEXE" , (char *)" UPDATEFIRMWARE" , (char *)" OTA Error" );
997+
953998 otaUpdateStop ();
954999 }
9551000 break ;
0 commit comments