From 44ca2c6a8ebb7367d286d58577f47ac9193a5eb0 Mon Sep 17 00:00:00 2001 From: Marcus Date: Tue, 22 Oct 2024 01:16:09 +0200 Subject: [PATCH] Update() fixes for esp32 https://github.com/me-no-dev/ESPAsyncWebServer/issues/455#issuecomment-451728099 --- Arduino/CanGrow/CanGrow.ino | 1 + Arduino/CanGrow/include/Webserver/Page_system.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index b6e35f5..56dd492 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -45,6 +45,7 @@ #include #include +#include #endif // https://github.com/mathieucarbou/ESPAsyncWebServer diff --git a/Arduino/CanGrow/include/Webserver/Page_system.h b/Arduino/CanGrow/include/Webserver/Page_system.h index 370b046..9f2e26b 100644 --- a/Arduino/CanGrow/include/Webserver/Page_system.h +++ b/Arduino/CanGrow/include/Webserver/Page_system.h @@ -95,7 +95,12 @@ void WebPage_system_restart(AsyncWebServerRequest *request) { void WebPage_system_update_ApplyUpdate(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){ if(!index){ Serial.printf(":: [Webserver:system:update:ApplyUpdate] Update Start: %s\n", filename.c_str()); + + // https://github.com/me-no-dev/ESPAsyncWebServer/issues/455#issuecomment-451728099 + // workaround for bug with ESP32 + #ifdef ESP8266 Update.runAsync(true); + #endif if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)){ Update.printError(Serial); }