mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
added basic GET json
This commit is contained in:
parent
d0f3ea34c8
commit
33fae44163
2 changed files with 16 additions and 1 deletions
|
@ -15,3 +15,4 @@ framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
hideakitai/ArtNet @ ^0.8.0
|
hideakitai/ArtNet @ ^0.8.0
|
||||||
me-no-dev/ESP Async WebServer@^1.2.4
|
me-no-dev/ESP Async WebServer@^1.2.4
|
||||||
|
bblanchon/ArduinoJson @ ^7.2.0
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -1,6 +1,7 @@
|
||||||
#include <ArtnetWiFi.h>
|
#include <ArtnetWiFi.h>
|
||||||
// #include <ArtnetEther.h>
|
// #include <ArtnetEther.h>
|
||||||
|
|
||||||
|
#include <ArduinoJson.h>
|
||||||
#include "ESPDMX.h"
|
#include "ESPDMX.h"
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
|
@ -73,6 +74,19 @@ void setup()
|
||||||
|
|
||||||
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
||||||
|
|
||||||
|
server.on("/config", HTTP_GET, [&, defaultIp, ssid, pwd, universe](AsyncWebServerRequest *request)
|
||||||
|
{
|
||||||
|
DynamicJsonDocument doc(1024);
|
||||||
|
|
||||||
|
doc["ssid"] = ssid;
|
||||||
|
doc["pwd"] = pwd;
|
||||||
|
doc["ip"] = defaultIp;
|
||||||
|
doc["universe"] = universe;
|
||||||
|
|
||||||
|
String jsonString;
|
||||||
|
serializeJson(doc, jsonString);
|
||||||
|
|
||||||
|
request->send(200, "application/json", jsonString); });
|
||||||
delay(1000);
|
delay(1000);
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("Server started!");
|
Serial.println("Server started!");
|
||||||
|
|
Loading…
Add table
Reference in a new issue