mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
base logic for config
This commit is contained in:
parent
813c738537
commit
d0f3ea34c8
1 changed files with 19 additions and 15 deletions
34
src/main.cpp
34
src/main.cpp
|
@ -4,33 +4,36 @@
|
||||||
#include "ESPDMX.h"
|
#include "ESPDMX.h"
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
|
#include <Preferences.h>
|
||||||
|
|
||||||
// WiFi stuff
|
Preferences config;
|
||||||
const char *ssid = "artnet";
|
DMXESPSerial dmx;
|
||||||
const char *pwd = "mbgmbgmbg";
|
|
||||||
const IPAddress ip(192, 168, 1, 201);
|
|
||||||
const IPAddress gateway(192, 168, 1, 1);
|
|
||||||
const IPAddress subnet(255, 255, 255, 0);
|
|
||||||
|
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
// Art-Net stuff
|
|
||||||
ArtnetWiFi artnet;
|
ArtnetWiFi artnet;
|
||||||
// const String target_ip = "192.168.1.200";
|
|
||||||
uint8_t universe = 1; // 0 - 15
|
|
||||||
const uint16_t size = 512;
|
const uint16_t size = 512;
|
||||||
uint8_t data[size];
|
uint8_t data[size];
|
||||||
uint8_t value = 0;
|
|
||||||
|
|
||||||
// DMX stuff
|
|
||||||
DMXESPSerial dmx;
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Serial console
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
config.begin("dmx", false);
|
||||||
|
|
||||||
|
uint8_t universe = config.getUChar("universe", 1);
|
||||||
|
|
||||||
|
String ssid = config.getString("ssid", "artnet");
|
||||||
|
String pwd = config.getString("pwd", "mbgmbgmbg");
|
||||||
|
IPAddress defaultIp(192, 168, 1, 201);
|
||||||
|
IPAddress ip = config.getUInt("ip", defaultIp);
|
||||||
|
|
||||||
|
IPAddress cidr = config.getUChar("cidr", 24);
|
||||||
|
|
||||||
|
// TODO: \/ Herleiten \/ @psxde
|
||||||
|
const IPAddress gateway(192, 168, 1, 1);
|
||||||
|
const IPAddress subnet(255, 255, 255, 0);
|
||||||
|
|
||||||
// WiFi stuff
|
// WiFi stuff
|
||||||
// WiFi.begin(ssid, pwd);
|
// WiFi.begin(ssid, pwd);
|
||||||
WiFi.softAP(ssid, pwd);
|
WiFi.softAP(ssid, pwd);
|
||||||
|
@ -70,6 +73,7 @@ void setup()
|
||||||
|
|
||||||
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
server.serveStatic("/", SPIFFS, "/").setDefaultFile("index.html");
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("Server started!");
|
Serial.println("Server started!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue