Update() fixes for esp32
https://github.com/me-no-dev/ESPAsyncWebServer/issues/455#issuecomment-451728099
This commit is contained in:
parent
5af5bcd94d
commit
44ca2c6a8e
2 changed files with 6 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <AsyncTCP.h>
|
#include <AsyncTCP.h>
|
||||||
|
#include <Update.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// https://github.com/mathieucarbou/ESPAsyncWebServer
|
// https://github.com/mathieucarbou/ESPAsyncWebServer
|
||||||
|
|
|
@ -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){
|
void WebPage_system_update_ApplyUpdate(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
|
||||||
if(!index){
|
if(!index){
|
||||||
Serial.printf(":: [Webserver:system:update:ApplyUpdate] Update Start: %s\n", filename.c_str());
|
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);
|
Update.runAsync(true);
|
||||||
|
#endif
|
||||||
if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)){
|
if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)){
|
||||||
Update.printError(Serial);
|
Update.printError(Serial);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue