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