Skip to content

Commit 4e07296

Browse files
authored
Merge pull request #5323 from wled/ethernet_led_pin
Change default LED pin to 4 in esp32 ethernet builds and set AR default to "no mic" mode. The "normal" default LED pin 16 is conflicting with pins needed by many ethernet boards, which can cause random crashes.
2 parents 9683896 + 81af160 commit 4e07296

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,10 @@ upload_speed = 921600
511511
custom_usermods = audioreactive
512512
build_unflags = ${common.build_unflags}
513513
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
514+
-D SR_DMTYPE=-1 -D AUDIOPIN=-1 -D I2S_SDPIN=-1 -D I2S_WSPIN=-1 -D I2S_CKPIN=-1 -D MCLK_PIN=-1 ;; force AR to not allocate any PINs at startup
515+
-D DATA_PINS=4 ;; default led pin = 16 conflicts with pins used for ethernet
516+
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only => uncomment if your board uses ETH_CLOCK_GPIO0_OUT, ETH_CLOCK_GPIO16_OUT, ETH_CLOCK_GPIO17_OUT
514517
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
515-
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
516518
lib_deps = ${esp32.lib_deps}
517519
board_build.partitions = ${esp32.default_partitions}
518520
board_build.flash_mode = dio

wled00/const.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,12 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit");
611611
#define DEFAULT_LED_PIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards, safe to use on any board
612612
#endif
613613
#else
614-
#define DEFAULT_LED_PIN 16 // aligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards (if it is unusable it will be reassigned in WS2812FX::finalizeInit())
614+
#if defined(WLED_USE_ETHERNET)
615+
#define DEFAULT_LED_PIN 4 // GPIO4 seems to be a "safe bet" for all known ethernet boards (issue #5155)
616+
//#warning "Compiling with Ethernet support. The default LED pin has been changed to pin 4."
617+
#else
618+
#define DEFAULT_LED_PIN 16 // aligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards (if it is unusable it will be reassigned in WS2812FX::finalizeInit())
619+
#endif
615620
#endif
616621
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
617622
#define DEFAULT_LED_COUNT 30

0 commit comments

Comments
 (0)