OTA update improved error messages

The OTA update class can deliver an error message.

old: "Please check your file and retry"
new: "Could Not Activate The Firmware. (wrong board type?). Please check your file and retry!"
This commit is contained in:
Frank
2024-11-16 18:13:15 +01:00
parent 7167db4a22
commit 52509bab0f

View File

@@ -329,7 +329,15 @@ void initServer()
return;
}
if (Update.hasError() || otaLock) {
#ifdef ARDUINO_ARCH_ESP32
if (Update.hasError()) {
String updErr = Update.getError() == UPDATE_ERROR_ACTIVATE ? String("Could Not Activate The Firmware. (wrong board type?)") : String(Update.errorString());
serveMessage(request, 500, F("Update failed!"), updErr + String("<br>Please check your file and retry!"), 254);
} else
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry! (OTA may be locked)"), 254);
#else
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254);
#endif
} else {
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
doReboot = true;