mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-18 21:55:34 +00:00
added basic GET json
This commit is contained in:
parent
d0f3ea34c8
commit
33fae44163
2 changed files with 16 additions and 1 deletions
|
@ -14,4 +14,5 @@ board = lolin_s2_mini
|
|||
framework = arduino
|
||||
lib_deps =
|
||||
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 <ArtnetEther.h>
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include "ESPDMX.h"
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include <SPIFFS.h>
|
||||
|
@ -73,6 +74,19 @@ void setup()
|
|||
|
||||
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);
|
||||
server.begin();
|
||||
Serial.println("Server started!");
|
||||
|
|
Loading…
Add table
Reference in a new issue