@@ -461,6 +461,9 @@ bool otaCheckVersion(char *versionAvailable, uint8_t versionAvailableLength)
461
461
// Call getVersion after original inquiry
462
462
String otaVersion = ota.GetVersion ();
463
463
otaVersion.toCharArray (versionAvailable, versionAvailableLength);
464
+
465
+ if (settings.debugFirmwareUpdate )
466
+ systemPrintf (" Reported version available: %s\r\n " , versionAvailable);
464
467
}
465
468
else if (response == ESP32OTAPull::HTTP_FAILED)
466
469
{
@@ -809,7 +812,9 @@ void otaUpdateStop()
809
812
if (otaState != OTA_STATE_OFF)
810
813
{
811
814
// Stop network
812
- systemPrintln (" Firmware update releasing network request" );
815
+ if (settings.debugFirmwareUpdate )
816
+ systemPrintln (" Firmware update releasing network request" );
817
+
813
818
online.otaFirmwareUpdate = false ;
814
819
815
820
otaRequestFirmwareUpdate = false ; // Let the network know we no longer need it
@@ -882,34 +887,36 @@ void otaUpdate()
882
887
if (settings.debugFirmwareUpdate )
883
888
systemPrintln (" Firmware update checking SparkFun released firmware version" );
884
889
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 ;
887
893
888
894
// Get firmware version from server
889
895
otaReportedVersion[0 ] = 0 ;
890
896
if (otaCheckVersion (otaReportedVersion, sizeof (otaReportedVersion)))
891
897
{
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
-
900
898
// Create a string of the unit's current firmware version
901
899
char currentVersion[21 ];
902
900
getFirmwareVersion (currentVersion, sizeof (currentVersion), enableRCFirmware);
903
901
904
- // If we are doing a scheduled automatic update or a manually requested update, continue through the
905
- // state machine
906
-
907
902
// We got a version number, now determine if it's newer or not
903
+ // Allow update if locally compiled developer version
908
904
if ((isReportedVersionNewer (otaReportedVersion, ¤tVersion[1 ]) == true ) ||
909
905
(currentVersion[0 ] == ' d' ) || (FIRMWARE_VERSION_MAJOR == 99 ))
910
906
{
911
- // Allow update if locally compiled developer version
912
907
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
913
920
otaSetState (OTA_STATE_UPDATE_FIRMWARE);
914
921
}
915
922
else
0 commit comments