mirror of
https://gitlab.com/wirelos/sprocket-plugin-web.git
synced 2025-12-16 06:34:31 +01:00
esp32 compat
This commit is contained in:
@@ -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