From a5161eb7f152d81b9982936fdcd230b7a3cbe9cd Mon Sep 17 00:00:00 2001 From: Justin Mutter Date: Wed, 31 May 2023 11:35:43 -0400 Subject: [PATCH] Use constant for mDNS name to allow setting from my_config.h (#3145) --- wled00/const.h | 1 + wled00/my_config_sample.h | 3 ++- wled00/wled.h | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wled00/const.h b/wled00/const.h index f87db71d..cade2a0d 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -12,6 +12,7 @@ #define DEFAULT_AP_SSID "WLED-AP" #define DEFAULT_AP_PASS "wled1234" #define DEFAULT_OTA_PASS "wledota" +#define DEFAULT_MDNS_NAME "x" //increase if you need more #ifndef WLED_MAX_USERMODS diff --git a/wled00/my_config_sample.h b/wled00/my_config_sample.h index a7bd0f5a..000793de 100644 --- a/wled00/my_config_sample.h +++ b/wled00/my_config_sample.h @@ -22,4 +22,5 @@ #define CLIENT_PASS "Your_Password" */ -//#define MAX_LEDS 1500 //Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. \ No newline at end of file +//#define MAX_LEDS 1500 // Maximum total LEDs. More than 1500 might create a low memory situation on ESP8266. +//#define MDNS_NAME "wled" // mDNS hostname, ie: *.local diff --git a/wled00/wled.h b/wled00/wled.h index bcd87fd5..bb7938af 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -179,6 +179,10 @@ using PSRAMDynamicJsonDocument = BasicJsonDocument; #define CLIENT_PASS "" #endif +#ifndef MDNS_NAME + #define MDNS_NAME DEFAULT_MDNS_NAME +#endif + #if defined(WLED_AP_PASS) && !defined(WLED_AP_SSID) #error WLED_AP_PASS is defined but WLED_AP_SSID is still the default. \ Please change WLED_AP_SSID to something unique. @@ -289,7 +293,7 @@ WLED_GLOBAL char ntpServerName[33] _INIT("0.wled.pool.ntp.org"); // NTP server // WiFi CONFIG (all these can be changed via web UI, no need to set them here) WLED_GLOBAL char clientSSID[33] _INIT(CLIENT_SSID); WLED_GLOBAL char clientPass[65] _INIT(CLIENT_PASS); -WLED_GLOBAL char cmDNS[33] _INIT("x"); // mDNS address (placeholder, is replaced by wledXXXXXX.local) +WLED_GLOBAL char cmDNS[33] _INIT(MDNS_NAME); // mDNS address (*.local, replaced by wledXXXXXX if default is used) WLED_GLOBAL char apSSID[33] _INIT(""); // AP off by default (unless setup) WLED_GLOBAL byte apChannel _INIT(1); // 2.4GHz WiFi AP channel (1-13) WLED_GLOBAL byte apHide _INIT(0); // hidden AP SSID