Skip to content

Commit dcba4ab

Browse files
committed
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.
1 parent 1d3aed1 commit dcba4ab

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

platformio.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,11 @@ platform_packages = ${esp32.platform_packages}
503503
upload_speed = 921600
504504
build_unflags = ${common.build_unflags}
505505
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
506-
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
507506
${esp32.AR_build_flags}
507+
-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
508+
-D DATA_PINS=4 ;; default led pin = 16 conflicts with pins used for ethernet
509+
; -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
510+
-DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3
508511
lib_deps = ${esp32.lib_deps}
509512
${esp32.AR_lib_deps}
510513
board_build.partitions = ${esp32.default_partitions}

wled00/const.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,12 @@
582582
#define DEFAULT_LED_PIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards, safe to use on any board
583583
#endif
584584
#else
585-
#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())
585+
#if defined(WLED_USE_ETHERNET)
586+
#define DEFAULT_LED_PIN 4 // GPIO4 seems to be a "safe bet" for all known ethernet boards (issue #5155)
587+
//#warning "Compiling with Ethernet support. The default LED pin has been changed to pin 4."
588+
#else
589+
#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())
590+
#endif
586591
#endif
587592
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
588593
#define DEFAULT_LED_COUNT 30

0 commit comments

Comments
 (0)