|
|
@ -65,7 +65,8 @@ void _otaFrom(const char * host, unsigned int port, const char * url) { |
|
|
|
|
|
|
|
if (Update.end(true)){ |
|
|
|
DEBUG_MSG_P(PSTR("[OTA] Success: %u bytes\n"), _ota_size); |
|
|
|
deferredReset(100, CUSTOM_RESET_OTA); |
|
|
|
nice_delay(100); |
|
|
|
ESP.restart(); |
|
|
|
} else { |
|
|
|
#ifdef DEBUG_PORT
|
|
|
|
Update.printError(DEBUG_PORT); |
|
|
@ -133,6 +134,13 @@ void _otaFrom(const char * host, unsigned int port, const char * url) { |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
// Cache current reset reason
|
|
|
|
resetReason(); |
|
|
|
|
|
|
|
// Set reset reason beforehand,
|
|
|
|
// to prevent writing to EEPROM after the upgrade
|
|
|
|
resetReason(CUSTOM_RESET_OTA); |
|
|
|
|
|
|
|
// Backup EEPROM data to last sector
|
|
|
|
eepromBackup(); |
|
|
|
|
|
|
@ -217,6 +225,13 @@ void otaSetup() { |
|
|
|
|
|
|
|
ArduinoOTA.onStart([]() { |
|
|
|
|
|
|
|
// Cache current reset reason
|
|
|
|
resetReason(); |
|
|
|
|
|
|
|
// Set reset reason beforehand,
|
|
|
|
// to prevent writing to EEPROM after the upgrade
|
|
|
|
resetReason(CUSTOM_RESET_OTA); |
|
|
|
|
|
|
|
// Backup EEPROM data to last sector
|
|
|
|
eepromBackup(); |
|
|
|
|
|
|
@ -234,7 +249,8 @@ void otaSetup() { |
|
|
|
#if WEB_SUPPORT
|
|
|
|
wsSend_P(PSTR("{\"action\": \"reload\"}")); |
|
|
|
#endif
|
|
|
|
deferredReset(100, CUSTOM_RESET_OTA); |
|
|
|
nice_delay(100); |
|
|
|
ESP.restart(); |
|
|
|
}); |
|
|
|
|
|
|
|
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { |
|
|
|