diff --git a/wiflash_esp32/wiflash_esp32.ino b/wiflash_esp32/wiflash_esp32.ino index d36aba1..06e1e2d 100644 --- a/wiflash_esp32/wiflash_esp32.ino +++ b/wiflash_esp32/wiflash_esp32.ino @@ -28,8 +28,10 @@ #include #include +#include #include #include +#include #include #include "sacn.h" #include "strobe_esp32.h" @@ -81,6 +83,7 @@ struct config_ config; Strobe *strobe; NeoPixelBus *strip; ESPAsyncE131 *e131 = new ESPAsyncE131(); +AsyncWebServer server(80); Preferences prefs; //// static hardware @@ -161,6 +164,18 @@ bool loadConfig() { return true; } + +/* + Start the async web server +*/ +void startHTTPD() { + server.serveStatic("/", SPIFFS, "/www/").setDefaultFile("index.html"); + + server.onNotFound([](AsyncWebServerRequest * request) { + request->send(404, "text/plain", "Not found"); + }); + + server.begin(); } @@ -204,6 +219,12 @@ void setup() { Serial.println("Disabling Bluetooth."); btStop(); + Serial.println("Mounting SPI Flash FS."); + SPIFFS.begin(); + + Serial.println("Starting HTTP interface."); + startHTTPD(); + //// start fixtures hardware: // battery monitor