mirror of
https://gitlab.com/wirelos/sprocket-plugin-web.git
synced 2025-12-14 14:01:27 +01:00
esp32 compat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[platformio]
|
||||
env_default = basic
|
||||
;[platformio]
|
||||
;env_default = basic
|
||||
|
||||
[common]
|
||||
framework = arduino
|
||||
@@ -27,3 +27,16 @@ upload_speed = ${common.upload_speed}
|
||||
monitor_baud = ${common.monitor_baud}
|
||||
framework = ${common.framework}
|
||||
lib_deps = ${common.lib_deps}
|
||||
|
||||
[env:basic_esp32]
|
||||
src_filter = +<*> -<examples/> +<examples/basic/>
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
upload_speed = ${common.upload_speed}
|
||||
monitor_baud = ${common.monitor_baud}
|
||||
framework = ${common.framework}
|
||||
build_flags = -std=c++14 -DESP32
|
||||
lib_deps = ${common.lib_deps}
|
||||
AsyncWebServer
|
||||
AsyncTCP
|
||||
Update
|
||||
@@ -3,7 +3,6 @@
|
||||
WebApiPlugin::WebApiPlugin(AsyncWebServer *_server)
|
||||
{
|
||||
server = _server;
|
||||
Update.runAsync(true);
|
||||
}
|
||||
|
||||
void WebApiPlugin::activate(Scheduler *_scheduler)
|
||||
@@ -62,8 +61,13 @@ void WebApiPlugin::onFirmwareUpload(AsyncWebServerRequest *request, const String
|
||||
if (!index)
|
||||
{
|
||||
PRINT_MSG(Serial, "OTA", "Update Start %s", filename.c_str());
|
||||
#ifdef ESP8266
|
||||
Update.runAsync(true);
|
||||
if (!Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000))
|
||||
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
|
||||
#elif defined(ESP32)
|
||||
uint32_t maxSketchSpace = (1048576 - 0x1000) & 0xFFFFF000;
|
||||
#endif
|
||||
if (!Update.begin(maxSketchSpace))
|
||||
{
|
||||
Update.printError(Serial);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#include <TaskSchedulerDeclarations.h>
|
||||
#include <Sprocket.h>
|
||||
#ifdef ESP32
|
||||
#include <Update.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <Updater.h>
|
||||
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "utils/print.h"
|
||||
#include "WebUtils.h"
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
#include <Arduino.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <AsyncWebSocket.h>
|
||||
#ifdef ESP32
|
||||
#include <AsyncTCP.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <ESPAsyncTCP.h>
|
||||
#endif
|
||||
|
||||
class WebUtils
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user