mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-12 00:15:44 +00:00
extracted default config values
This commit is contained in:
parent
003102fa90
commit
a6500cb8cc
3 changed files with 44 additions and 38 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "WiFi.h"
|
||||
|
||||
Preferences config;
|
||||
String DEFAULT_SSID = "";
|
||||
|
||||
#pragma region Utility
|
||||
|
||||
|
@ -75,28 +76,23 @@ void onGetConfig(AsyncWebServerRequest *request)
|
|||
{
|
||||
config.begin("dmx", true);
|
||||
|
||||
IPAddress defaultIp(192, 168, 1, 201);
|
||||
IPAddress ip = config.getUInt("ip", defaultIp);
|
||||
|
||||
IPAddress defaultSubnet(255, 255, 255, 0);
|
||||
IPAddress subnet = config.getUInt("subnet", defaultSubnet);
|
||||
|
||||
IPAddress defaultGateway(192, 168, 1, 1);
|
||||
IPAddress gateway = config.getUInt("gateway", defaultGateway);
|
||||
IPAddress ip = config.getUInt("ip", DEFAULT_IP);
|
||||
IPAddress subnet = config.getUInt("subnet", DEFAULT_SUBNET);
|
||||
IPAddress gateway = config.getUInt("gateway", DEFAULT_GATEWAY);
|
||||
|
||||
JsonDocument doc;
|
||||
doc["connection"] = config.getUInt("connection", WiFiSta);
|
||||
doc["ssid"] = config.getString("ssid", "artnet");
|
||||
doc["password"] = config.getString("password", "mbgmbgmbg");
|
||||
doc["ip-method"] = config.getUInt("ip-method"), Static;
|
||||
doc["connection"] = config.getUInt("connection", DEFAULT_CONNECTION);
|
||||
doc["ssid"] = config.getString("ssid", DEFAULT_SSID);
|
||||
doc["password"] = config.getString("password", DEFAULT_PASSWORD);
|
||||
doc["ip-method"] = config.getUInt("ip-method", DEFAULT_IP_METHOD);
|
||||
doc["ip"] = ip.toString();
|
||||
doc["subnet"] = subnet.toString();
|
||||
doc["gateway"] = gateway.toString();
|
||||
doc["universe-1"] = config.getUInt("universe-1", 1);
|
||||
doc["direction-1"] = config.getUInt("direction-1", Output);
|
||||
doc["universe-2"] = config.getUInt("universe-2", 1);
|
||||
doc["direction-2"] = config.getUInt("direction-2", Input);
|
||||
doc["led-brightness"] = config.getUInt("led-brightness", 25);
|
||||
doc["universe-1"] = config.getUInt("universe-1", DEFAULT_UNIVERSE1);
|
||||
doc["direction-1"] = config.getUInt("direction-1", DEFAULT_DIRECTION1);
|
||||
doc["universe-2"] = config.getUInt("universe-2", DEFAULT_UNIVERSE2);
|
||||
doc["direction-2"] = config.getUInt("direction-2", DEFAULT_DIRECTION2);
|
||||
doc["led-brightness"] = config.getUInt("led-brightness", DEFAULT_LED_BRIGHTNESS);
|
||||
|
||||
config.end();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue