|
@ -141,18 +141,16 @@ class Web { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!Update.hasError()) { |
|
|
if (!Update.hasError()) { |
|
|
if (Update.write(data, len) != len) { |
|
|
if (Update.write(data, len) != len) |
|
|
Update.printError(Serial); |
|
|
Update.printError(Serial); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if (final) { |
|
|
if (final) { |
|
|
if (Update.end(true)) { |
|
|
if (Update.end(true)) |
|
|
Serial.printf("Update Success: %uB\n", index + len); |
|
|
Serial.printf("Update Success: %uB\n", index + len); |
|
|
} else { |
|
|
else |
|
|
Update.printError(Serial); |
|
|
Update.printError(Serial); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void onUpload2(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { |
|
|
void onUpload2(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { |
|
|
if (!index) { |
|
|
if (!index) { |
|
@ -245,7 +243,7 @@ class Web { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void showUpdate(AsyncWebServerRequest *request) { |
|
|
void showUpdate(AsyncWebServerRequest *request) { |
|
|
bool reboot = !Update.hasError(); |
|
|
bool reboot = (!Update.hasError() && Update.size() > 0); |
|
|
|
|
|
|
|
|
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: "); |
|
|
String html = F("<!doctype html><html><head><title>Update</title><meta http-equiv=\"refresh\" content=\"20; URL=/\"></head><body>Update: "); |
|
|
if (reboot) |
|
|
if (reboot) |
|
|