From b8dd1f1953f0f79cf41269e93cea0d95a58b688b Mon Sep 17 00:00:00 2001 From: Patrick Schwarz Date: Wed, 23 Oct 2024 17:16:53 +0200 Subject: [PATCH 1/5] DMX-17 init branch --- src/webtest.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/webtest.cpp diff --git a/src/webtest.cpp b/src/webtest.cpp new file mode 100644 index 0000000..e69de29 From 55348d19f53cd4736c88a21af51b92a30b964d9a Mon Sep 17 00:00:00 2001 From: Patrick Schwarz Date: Wed, 23 Oct 2024 20:29:31 +0200 Subject: [PATCH 2/5] fixed libs and deleted unnecessary file --- platformio.ini | 2 +- src/webtest.cpp | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/webtest.cpp diff --git a/platformio.ini b/platformio.ini index 07919a5..35735e1 100644 --- a/platformio.ini +++ b/platformio.ini @@ -14,4 +14,4 @@ board = lolin_s2_mini framework = arduino lib_deps = hideakitai/ArtNet @ ^0.8.0 - someweisguy/esp_dmx @ ^4.1.0 \ No newline at end of file + me-no-dev/ESP Async WebServer@^1.2.4 \ No newline at end of file diff --git a/src/webtest.cpp b/src/webtest.cpp deleted file mode 100644 index e69de29..0000000 From ab1e60ba03fd3aa82bfdac02ed8b2cd0af7dd01d Mon Sep 17 00:00:00 2001 From: Hendrik Rauh <114620133+HendrikRauh@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:35:49 +0200 Subject: [PATCH 3/5] added a basic html site --- src/main.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f703549..944bec1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,10 +1,8 @@ -// Art-Net DMX Interface Demo -// 2024-10-17 Patrick Schwarz - #include // #include #include "ESPDMX.h" +#include // WiFi stuff const char *ssid = "artnet"; @@ -13,6 +11,8 @@ const IPAddress ip(192, 168, 1, 201); const IPAddress gateway(192, 168, 1, 1); const IPAddress subnet(255, 255, 255, 0); +AsyncWebServer server(80); + // Art-Net stuff ArtnetWiFi artnet; // const String target_ip = "192.168.1.200"; @@ -28,7 +28,7 @@ void setup() { // Serial console - // Serial.begin(115200); + Serial.begin(9600); // WiFi stuff // WiFi.begin(ssid, pwd); @@ -89,6 +89,15 @@ void setup() Serial.print(", size = "); Serial.print(size); Serial.println(")");*/ }); + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) + { + Serial.println("ESP32 Web Server: New request received:"); // for debugging + Serial.println("GET /"); // for debugging + request->send(200, "text/html", "

Hello, I'm a DMX-INTERFACE!

"); }); + + server.begin(); + Serial.println("Server started!"); } void loop() From 6665df4cc6e5987f4b1faa926ac83698b2825897 Mon Sep 17 00:00:00 2001 From: Hendrik Rauh <114620133+HendrikRauh@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:39:41 +0200 Subject: [PATCH 4/5] DMX-17 made data-files possible --- data/index.html | 11 +++++++++++ src/main.cpp | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 data/index.html diff --git a/data/index.html b/data/index.html new file mode 100644 index 0000000..9878ae4 --- /dev/null +++ b/data/index.html @@ -0,0 +1,11 @@ + + + + + + Test + + + Your advert could be placed here + + diff --git a/src/main.cpp b/src/main.cpp index 944bec1..cd75af7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,7 @@ #include "ESPDMX.h" #include +#include // WiFi stuff const char *ssid = "artnet"; @@ -90,11 +91,17 @@ void setup() Serial.print(size); Serial.println(")");*/ }); + if (!SPIFFS.begin(true)) + { + Serial.println("An Error has occurred while mounting SPIFFS"); + return; + } + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { Serial.println("ESP32 Web Server: New request received:"); // for debugging Serial.println("GET /"); // for debugging - request->send(200, "text/html", "

Hello, I'm a DMX-INTERFACE!

"); }); + request->send(SPIFFS, "/index.html"); }); server.begin(); Serial.println("Server started!"); From 6d2386f080d500b57c6494ada71db95b9edad87b Mon Sep 17 00:00:00 2001 From: Hendrik Rauh <114620133+HendrikRauh@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:53:30 +0200 Subject: [PATCH 5/5] DMX-17 made server serve static correctly --- src/main.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cd75af7..e10e20c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -97,11 +97,7 @@ void setup() return; } - server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) - { - Serial.println("ESP32 Web Server: New request received:"); // for debugging - Serial.println("GET /"); // for debugging - request->send(SPIFFS, "/index.html"); }); + server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html"); server.begin(); Serial.println("Server started!");