set configurable hostname
This commit is contained in:
parent
fb8906aff0
commit
5d951eba47
@ -51,6 +51,7 @@ struct config_ {
|
||||
String ip;
|
||||
String subnet;
|
||||
String gateway;
|
||||
String hostname;
|
||||
|
||||
String osc_host;
|
||||
uint16_t osc_port;
|
||||
@ -80,6 +81,7 @@ struct config_ config;
|
||||
Strobe *strobe;
|
||||
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> *strip;
|
||||
ESPAsyncE131 *e131 = new ESPAsyncE131();
|
||||
Preferences prefs;
|
||||
|
||||
//// Global button variables
|
||||
bool pressed = false; // track button state
|
||||
@ -127,6 +129,7 @@ bool loadConfig() {
|
||||
config.ssid = prefs.getString("ssid", "WiFlash");
|
||||
config.pwd = prefs.getString("pwd", "technologyismagic");
|
||||
config.mode = (wifi_mode_t)prefs.getChar("wifi_mode", WIFI_AP);
|
||||
config.hostname = prefs.getString("hostname", "WiFlash");
|
||||
|
||||
config.ip = prefs.getString("ip", "192.168.1.1");
|
||||
config.subnet = prefs.getString("subnet", "255.255.255.0");
|
||||
@ -173,6 +176,7 @@ void setup() {
|
||||
// set IPv4
|
||||
Serial.println("Starting WiFi.");
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.setHostname(config.hostname.c_str());
|
||||
IPAddress ip_, gateway_, subnet_;
|
||||
ip_.fromString(config.ip);
|
||||
gateway_.fromString(config.gateway);
|
||||
|
Loading…
Reference in New Issue
Block a user