Skip to content

Commit d00b32e

Browse files
committed
bugfix - unusable pins on pico32 boards (wled#3573)
According to the technical manual, GPIO 16 + 17 are used for onboard flash, so cannot be used by WLED. example buildenv: [env:esp32_pico] extends = env:esp32dev_qio80 board = pico32
1 parent 627e002 commit d00b32e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

wled00/const.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,9 @@
470470

471471
//this is merely a default now and can be changed at runtime
472472
#ifndef LEDPIN
473-
#if defined(ESP8266) || (defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)) || defined(CONFIG_IDF_TARGET_ESP32C3)
474-
#define LEDPIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards
473+
474+
#if defined(ESP8266) || (defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ARDUINO_ESP32_PICO)
475+
#define LEDPIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards, and on boards where GPIO16 is not available
475476
#else
476477
#define LEDPIN 16 // aligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards
477478
#endif

wled00/wled.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ void WLED::setup()
584584
#else
585585
DEBUG_PRINTLN(F("PSRAM not used."));
586586
#endif
587+
#endif
588+
#if defined(ARDUINO_ESP32_PICO)
589+
// special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM)
590+
managed_pin_type pins[] = { {16, true}, {17, true} };
591+
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
587592
#endif
588593

589594
//DEBUG_PRINT(F("LEDs inited. heap usage ~"));

0 commit comments

Comments
 (0)