@@ -461,6 +461,9 @@ bool otaCheckVersion(char *versionAvailable, uint8_t versionAvailableLength)
461461 // Call getVersion after original inquiry
462462 String otaVersion = ota.GetVersion ();
463463 otaVersion.toCharArray (versionAvailable, versionAvailableLength);
464+
465+ if (settings.debugFirmwareUpdate )
466+ systemPrintf (" Reported version available: %s\r\n " , versionAvailable);
464467 }
465468 else if (response == ESP32OTAPull::HTTP_FAILED)
466469 {
@@ -809,7 +812,9 @@ void otaUpdateStop()
809812 if (otaState != OTA_STATE_OFF)
810813 {
811814 // Stop network
812- systemPrintln (" Firmware update releasing network request" );
815+ if (settings.debugFirmwareUpdate )
816+ systemPrintln (" Firmware update releasing network request" );
817+
813818 online.otaFirmwareUpdate = false ;
814819
815820 otaRequestFirmwareUpdate = false ; // Let the network know we no longer need it
@@ -882,34 +887,36 @@ void otaUpdate()
882887 if (settings.debugFirmwareUpdate )
883888 systemPrintln (" Firmware update checking SparkFun released firmware version" );
884889
885- // Only update to production firmware, disable release candidates
886- enableRCFirmware = 0 ;
890+ // If we are using auto updates, only update to production firmware, disable release candidates
891+ if (settings.enableAutoFirmwareUpdate )
892+ enableRCFirmware = 0 ;
887893
888894 // Get firmware version from server
889895 otaReportedVersion[0 ] = 0 ;
890896 if (otaCheckVersion (otaReportedVersion, sizeof (otaReportedVersion)))
891897 {
892- // If we are doing just a version check, set version number, turn off network request and stop machine
893- if (otaRequestFirmwareVersionCheck == true )
894- {
895- otaRequestFirmwareVersionCheck = false ;
896- otaUpdateStop ();
897- return ;
898- }
899-
900898 // Create a string of the unit's current firmware version
901899 char currentVersion[21 ];
902900 getFirmwareVersion (currentVersion, sizeof (currentVersion), enableRCFirmware);
903901
904- // If we are doing a scheduled automatic update or a manually requested update, continue through the
905- // state machine
906-
907902 // We got a version number, now determine if it's newer or not
903+ // Allow update if locally compiled developer version
908904 if ((isReportedVersionNewer (otaReportedVersion, ¤tVersion[1 ]) == true ) ||
909905 (currentVersion[0 ] == ' d' ) || (FIRMWARE_VERSION_MAJOR == 99 ))
910906 {
911- // Allow update if locally compiled developer version
912907 systemPrintf (" Version Check: New firmware version available: %s\r\n " , otaReportedVersion);
908+
909+ // If we are doing just a version check, set version number, turn off network request and stop
910+ // machine
911+ if (otaRequestFirmwareVersionCheck == true )
912+ {
913+ otaRequestFirmwareVersionCheck = false ;
914+ otaUpdateStop ();
915+ return ;
916+ }
917+
918+ // If we are doing a scheduled automatic update or a manually requested update, continue through the
919+ // state machine
913920 otaSetState (OTA_STATE_UPDATE_FIRMWARE);
914921 }
915922 else
0 commit comments