This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
#include "../global_data/defines.h"
|
||||
#include <Preferences.h>
|
||||
#include <fetchOTA.h>
|
||||
#include <AsyncWebSocket.h>
|
||||
|
||||
extern Preferences prefs;
|
||||
extern OTAStatus ota_status;
|
||||
extern AsyncWebSocket ws;
|
||||
|
||||
extern Version current_spiffs_version;
|
||||
|
||||
@@ -59,7 +61,7 @@ void update_progress(int cur, int total) {
|
||||
if (cur != 0 ) {
|
||||
ota_status.update_progress = total/cur;
|
||||
}
|
||||
|
||||
ws.textAll(String(ota_status.update_progress).c_str());
|
||||
Log.verbose("OTA Update progress: %d/%d", cur, total);
|
||||
}
|
||||
|
||||
@@ -131,4 +133,15 @@ void run_ota_update_task(void* parameter) {
|
||||
Log.verbose("Running OTA upgrade now with URL: %s", args->ota_status.update_url.c_str());
|
||||
run_ota_update(args->ota_status.update_url, update_started, update_finished, update_progress, update_error);
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type,
|
||||
void *arg, uint8_t *data, size_t len) {
|
||||
if (type == WS_EVT_CONNECT) {
|
||||
Serial.println("WebSocket client connected");
|
||||
} else if (type == WS_EVT_DISCONNECT) {
|
||||
Serial.println("WebSocket client disconnected");
|
||||
} else if (type == WS_EVT_DATA) {
|
||||
// Optionally process data received from the client
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user