Skip to content

Commit d947fdd

Browse files
committed
allow to set static IP adress at compile time
1 parent 496b5c3 commit d947fdd

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

platformio.ini

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,21 +1854,23 @@ build_unflags = ${esp32_4MB_V4_M_base.build_unflags}
18541854
;;${Speed_Flags.build_unflags} ;; to override -Os
18551855
build_flags = ${esp32_4MB_V4_M_base.build_flags}
18561856
-D WLED_RELEASE_NAME=esp32_16MB_M_eth_debug ; This will be included in the firmware.bin filename
1857+
-D SERVERNAME='"WLED-QEMU"'
18571858
;;${Speed_Flags.build_flags_V4} ;; optimize for speed
18581859
-g3 -ggdb ;; better debug output
18591860
-DCORE_DEBUG_LEVEL=5 ;; max core debug output
18601861
-DDEBUG -D WLED_DEBUG -DWLED_DEBUG_JSON ;; -DWLED_DEBUG_FS ;; max WLED debugging output
1862+
-D WLED_DISABLE_BROWNOUT_DET -D WLED_WATCHDOG_TIMEOUT=0
18611863
-D WLED_USE_ETHERNET
18621864
-D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
18631865
-D CONFIG_ETH_USE_OPENETH ;; enable open_eth support
18641866
-D WLED_ETH_DEFAULT=2 ;; ESP32-POE board configuration (works with QEMU open_eth)
18651867
-D WLED_QEMU ;; Skip ethernet hardware initialization for QEMU compatibility
18661868
;; Static IP for QEMU testing - user-mode networking provides DHCP at 10.0.2.0/24
18671869
;; If DHCP fails, uncomment these lines to use static IP:
1868-
; -D WLED_STATIC_IP_DEFAULT_1=10
1869-
; -D WLED_STATIC_IP_DEFAULT_2=0
1870-
; -D WLED_STATIC_IP_DEFAULT_3=2
1871-
; -D WLED_STATIC_IP_DEFAULT_4=15
1870+
-D WLED_STATIC_IP_DEFAULT_1=10
1871+
-D WLED_STATIC_IP_DEFAULT_2=0
1872+
-D WLED_STATIC_IP_DEFAULT_3=2
1873+
-D WLED_STATIC_IP_DEFAULT_4=15
18721874
-D MDNS_NAME=\"\" ;; disable MDNS
18731875
-D WLED_DISABLE_INFRARED
18741876
-D BTNPIN=-1 -D RLYPIN=1 -D IRPIN=-1 ;; disable all extra pins

wled00/wled.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BUTTON_ONLY); // access poi
355355
#else
356356
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BOOT_NO_CONN); // access point opens when no connection after boot by default
357357
#endif
358+
#ifdef WLED_STATIC_IP_DEFAULT_1
359+
WLED_GLOBAL IPAddress staticIP _INIT_N((( WLED_STATIC_IP_DEFAULT_1, WLED_STATIC_IP_DEFAULT_2, WLED_STATIC_IP_DEFAULT_3, WLED_STATIC_IP_DEFAULT_4)));
360+
#else
358361
WLED_GLOBAL IPAddress staticIP _INIT_N((( 0, 0, 0, 0))); // static IP of ESP
362+
#endif
359363
WLED_GLOBAL IPAddress staticGateway _INIT_N((( 0, 0, 0, 0))); // gateway (router) IP
360364
WLED_GLOBAL IPAddress staticSubnet _INIT_N(((255, 255, 255, 0))); // most common subnet in home networks
361365
#if defined(ARDUINO_ARCH_ESP32) && !defined(ARDUINO_ESP32_PICO) && !defined(WLEDMM_WIFI_POWERON_HACK)

0 commit comments

Comments
 (0)