mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-12-15 23:34:07 +00:00
added missing fields and fixed loading of IP
This commit is contained in:
parent
11f91075d3
commit
eff77036cd
3 changed files with 19 additions and 9 deletions
14
src/main.cpp
14
src/main.cpp
|
|
@ -19,7 +19,11 @@ void setup()
|
|||
|
||||
config.begin("dmx", false);
|
||||
|
||||
uint8_t universe = config.getUChar("universe", 1);
|
||||
uint8_t universe1 = config.getUChar("universe-1", 1);
|
||||
uint8_t universe2 = config.getUChar("universe-2", 1);
|
||||
|
||||
Direction direction1 = static_cast<Direction>(config.getUInt("direction-1", 0));
|
||||
Direction direction2 = static_cast<Direction>(config.getUInt("direction-2", 1));
|
||||
|
||||
String ssid = config.getString("ssid", "artnet");
|
||||
String pwd = config.getString("password", "mbgmbgmbg");
|
||||
|
|
@ -51,7 +55,7 @@ void setup()
|
|||
dmx.init();
|
||||
|
||||
// if Artnet packet comes to this universe, this function is called
|
||||
artnet.subscribeArtDmxUniverse(universe, [&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote)
|
||||
artnet.subscribeArtDmxUniverse(universe1, [&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote)
|
||||
{
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
|
|
@ -71,15 +75,15 @@ void setup()
|
|||
|
||||
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
||||
|
||||
server.on("/config", HTTP_GET, [&, defaultIp, ssid, pwd, universe](AsyncWebServerRequest *request)
|
||||
{ onGetConfig(ssid, pwd, defaultIp, universe, request); });
|
||||
server.on("/config", HTTP_GET, [&, defaultIp, ssid, pwd, direction1, universe1, direction2, universe2](AsyncWebServerRequest *request)
|
||||
{ onGetConfig(ssid, pwd, defaultIp, universe1, direction1, universe2, direction2, request); });
|
||||
|
||||
server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total)
|
||||
{
|
||||
if (request->url() == "/config" && request->method() == HTTP_PUT) {
|
||||
onPutConfig(request, data, len, index, total);
|
||||
} });
|
||||
|
||||
|
||||
delay(1000);
|
||||
server.begin();
|
||||
Serial.println("Server started!");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue