mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-12-15 23:34:07 +00:00
extracted default config values
This commit is contained in:
parent
1e52c401e4
commit
c3fab50ccc
3 changed files with 44 additions and 38 deletions
29
src/main.cpp
29
src/main.cpp
|
|
@ -102,7 +102,7 @@ void setup()
|
|||
|
||||
// LED
|
||||
config.begin("dmx", true);
|
||||
brightness_led = config.getUInt("led-brightness", 20);
|
||||
brightness_led = config.getUInt("led-brightness", DEFAULT_LED_BRIGHTNESS);
|
||||
config.end();
|
||||
analogWrite(PIN_LED, brightness_led);
|
||||
// delay(5000);
|
||||
|
|
@ -127,11 +127,11 @@ void setup()
|
|||
|
||||
config.begin("dmx", true);
|
||||
|
||||
universe1 = config.getUChar("universe-1", 1);
|
||||
universe2 = config.getUChar("universe-2", 1);
|
||||
universe1 = config.getUChar("universe-1", DEFAULT_UNIVERSE1);
|
||||
universe2 = config.getUChar("universe-2", DEFAULT_UNIVERSE2);
|
||||
|
||||
direction1 = static_cast<Direction>(config.getUInt("direction-1", 0));
|
||||
direction2 = static_cast<Direction>(config.getUInt("direction-2", 1));
|
||||
direction1 = static_cast<Direction>(config.getUInt("direction-1", DEFAULT_DIRECTION1));
|
||||
direction2 = static_cast<Direction>(config.getUInt("direction-2", DEFAULT_DIRECTION2));
|
||||
|
||||
Serial.print("Port A: Universe ");
|
||||
Serial.print(universe1);
|
||||
|
|
@ -143,25 +143,22 @@ void setup()
|
|||
Serial.print(" ");
|
||||
Serial.println((direction2 == Input) ? "DMX -> Art-Net" : "Art-Net -> DMX");
|
||||
|
||||
Connection connection = static_cast<Connection>(config.getUInt("connection", WiFiAP));
|
||||
IpMethod ipMethod = static_cast<IpMethod>(config.getUInt("ip-method"), DHCP);
|
||||
Connection connection = static_cast<Connection>(config.getUInt("connection", DEFAULT_CONNECTION));
|
||||
IpMethod ipMethod = static_cast<IpMethod>(config.getUInt("ip-method"), DEFAULT_IP_METHOD);
|
||||
|
||||
WiFi.macAddress(mac);
|
||||
char hostname[30];
|
||||
snprintf(hostname, sizeof(hostname), "ChaosDMX-%02X%02X", mac[4], mac[5]);
|
||||
DEFAULT_SSID = hostname;
|
||||
Serial.print("Hostname: ");
|
||||
Serial.println(hostname);
|
||||
|
||||
String ssid = config.getString("ssid", hostname);
|
||||
String pwd = config.getString("password", "mbgmbgmbg");
|
||||
String ssid = config.getString("ssid", DEFAULT_SSID);
|
||||
String pwd = config.getString("password", DEFAULT_PASSWORD);
|
||||
|
||||
// Default IP as defined in standard https://art-net.org.uk/downloads/art-net.pdf, page 13
|
||||
IPAddress defaultIp(2, mac[3], mac[4], mac[5]);
|
||||
IPAddress ip = config.getUInt("ip", defaultIp);
|
||||
IPAddress defaultSubnet(255, 0, 0, 0);
|
||||
IPAddress subnet = config.getUInt("subnet", defaultSubnet);
|
||||
IPAddress defaultGateway(2, 0, 0, 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);
|
||||
|
||||
config.end();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue