From 32bd8ae7921c2ef74c03a94a919b013b7546322c Mon Sep 17 00:00:00 2001 From: castillo92 <37965565+castillo92@users.noreply.github.com> Date: Sun, 28 Feb 2021 01:59:16 +0100 Subject: [PATCH] Update AsyncUpdate.ino I saw a little bug: after upload, it did not show the message "Please wait while the device reboots", so I implemented another way to get that and redirect to main page after a seconds. Best regards! --- AsyncUpdate.ino | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/AsyncUpdate.ino b/AsyncUpdate.ino index caa1a38..5afcf72 100644 --- a/AsyncUpdate.ino +++ b/AsyncUpdate.ino @@ -50,6 +50,7 @@ void handleDoUpdate(AsyncWebServerRequest *request, const String& filename, size #endif Update.printError(Serial); } + request->send(200, "text/html", "
Upload complete! Please wait while the device reboots"); } if (Update.write(data, len) != len) { @@ -61,10 +62,6 @@ void handleDoUpdate(AsyncWebServerRequest *request, const String& filename, size } if (final) { - AsyncWebServerResponse *response = request->beginResponse(302, "text/plain", "Please wait while the device reboots"); - response->addHeader("Refresh", "20"); - response->addHeader("Location", "/"); - request->send(response); if (!Update.end(true)){ Update.printError(Serial); } else {