From 677acb9416117829b42055a52f84245dc5584970 Mon Sep 17 00:00:00 2001 From: "Sandner, Denny" Date: Mon, 19 Sep 2022 19:29:46 +0200 Subject: [PATCH] ESP32 build corrected --- tools/esp8266/platformio.ini | 16 ++++++++++++++-- tools/esp8266/web.cpp | 2 ++ tools/esp8266/web.h | 7 ++++++- tools/esp8266/webApi.h | 6 +++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tools/esp8266/platformio.ini b/tools/esp8266/platformio.ini index f18c0877..68b00df8 100644 --- a/tools/esp8266/platformio.ini +++ b/tools/esp8266/platformio.ini @@ -36,8 +36,6 @@ lib_deps = paulstoffregen/Time@^1.6.1 knolleary/PubSubClient@^2.8 bblanchon/ArduinoJson@^6.19.4 - me-no-dev/ESP Async WebServer@^1.2.3 - me-no-dev/ESPAsyncTCP@^1.2.2 ;esp8266/DNSServer@1.1.0 ;esp8266/EEPROM@^1.0 ;esp8266/ESP8266WiFi@^1.0 @@ -49,6 +47,9 @@ platform = espressif8266 board = esp12e board_build.f_cpu = 80000000L build_flags = -D RELEASE +lib_deps = ${env.lib_deps} + me-no-dev/ESP Async WebServer@^1.2.3 + me-no-dev/ESPAsyncTCP@^1.2.2 monitor_filters = ;default ; Remove typical terminal control codes from input time ; Add timestamp with milliseconds for each new line @@ -60,6 +61,9 @@ board = esp12e board_build.f_cpu = 80000000L build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial build_type = debug +lib_deps = ${env.lib_deps} + me-no-dev/ESP Async WebServer@^1.2.3 + me-no-dev/ESPAsyncTCP@^1.2.2 monitor_filters = ;default ; Remove typical terminal control codes from input time ; Add timestamp with milliseconds for each new line @@ -69,6 +73,10 @@ monitor_filters = platform = espressif32 board = lolin_d32 build_flags = -D RELEASE +lib_deps = ${env.lib_deps} + https://github.com/me-no-dev/ESPAsyncWebServer.git + me-no-dev/AsyncTCP@^1.1.1 +upload_port = /dev/cu.SLAB_USBtoUART monitor_filters = ;default ; Remove typical terminal control codes from input time ; Add timestamp with milliseconds for each new line @@ -79,6 +87,10 @@ platform = espressif32 board = lolin_d32 build_flags = -DDEBUG_LEVEL=DBG_DEBUG -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_OOM -DDEBUG_ESP_PORT=Serial build_type = debug +lib_deps = ${env.lib_deps} + https://github.com/me-no-dev/ESPAsyncWebServer.git + me-no-dev/AsyncTCP@^1.1.1 +upload_port = /dev/cu.SLAB_USBtoUART monitor_filters = ;default ; Remove typical terminal control codes from input time ; Add timestamp with milliseconds for each new line diff --git a/tools/esp8266/web.cpp b/tools/esp8266/web.cpp index b36a645a..1aadebc1 100644 --- a/tools/esp8266/web.cpp +++ b/tools/esp8266/web.cpp @@ -431,7 +431,9 @@ void web::showUpdate(AsyncWebServerRequest *request) { void web::showUpdate2(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { if(!index) { Serial.printf("Update Start: %s\n", filename.c_str()); +#ifndef ESP32 Update.runAsync(true); +#endif if(!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000)) { Update.printError(Serial); } diff --git a/tools/esp8266/web.h b/tools/esp8266/web.h index c5081598..a91d9d3a 100644 --- a/tools/esp8266/web.h +++ b/tools/esp8266/web.h @@ -7,7 +7,12 @@ #define __WEB_H__ #include "dbg.h" -#include "ESPAsyncTCP.h" +#ifdef ESP32 + #include "AsyncTCP.h" + #include "Update.h" +#else + #include "ESPAsyncTCP.h" +#endif #include "ESPAsyncWebServer.h" #include "app.h" #include "webApi.h" diff --git a/tools/esp8266/webApi.h b/tools/esp8266/webApi.h index b702ccf0..cd42ab30 100644 --- a/tools/esp8266/webApi.h +++ b/tools/esp8266/webApi.h @@ -2,7 +2,11 @@ #define __WEB_API_H__ #include "dbg.h" -#include "ESPAsyncTCP.h" +#ifdef ESP32 + #include "AsyncTCP.h" +#else + #include "ESPAsyncTCP.h" +#endif #include "ESPAsyncWebServer.h" #include "AsyncJson.h" #include "app.h"