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]
|
;[platformio]
|
||||||
env_default = basic
|
;env_default = basic
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
framework = arduino
|
framework = arduino
|
||||||
@@ -26,4 +26,17 @@ board = ${common.board}
|
|||||||
upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
monitor_baud = ${common.monitor_baud}
|
monitor_baud = ${common.monitor_baud}
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
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)
|
WebApiPlugin::WebApiPlugin(AsyncWebServer *_server)
|
||||||
{
|
{
|
||||||
server = _server;
|
server = _server;
|
||||||
Update.runAsync(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebApiPlugin::activate(Scheduler *_scheduler)
|
void WebApiPlugin::activate(Scheduler *_scheduler)
|
||||||
@@ -62,8 +61,13 @@ void WebApiPlugin::onFirmwareUpload(AsyncWebServerRequest *request, const String
|
|||||||
if (!index)
|
if (!index)
|
||||||
{
|
{
|
||||||
PRINT_MSG(Serial, "OTA", "Update Start %s", filename.c_str());
|
PRINT_MSG(Serial, "OTA", "Update Start %s", filename.c_str());
|
||||||
|
#ifdef ESP8266
|
||||||
Update.runAsync(true);
|
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);
|
Update.printError(Serial);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
#include <TaskSchedulerDeclarations.h>
|
#include <TaskSchedulerDeclarations.h>
|
||||||
#include <Sprocket.h>
|
#include <Sprocket.h>
|
||||||
|
#ifdef ESP32
|
||||||
|
#include <Update.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
#include <Updater.h>
|
#include <Updater.h>
|
||||||
|
#endif
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "utils/print.h"
|
#include "utils/print.h"
|
||||||
#include "WebUtils.h"
|
#include "WebUtils.h"
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <AsyncWebSocket.h>
|
#include <AsyncWebSocket.h>
|
||||||
|
#ifdef ESP32
|
||||||
|
#include <AsyncTCP.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
#include <ESPAsyncTCP.h>
|
#include <ESPAsyncTCP.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class WebUtils
|
class WebUtils
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user