Skip to content

Commit a8bd46c

Browse files
committed
bugfix - unusable pins on pico32 boards (#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 1ec3a74 commit a8bd46c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

wled00/const.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@
460460

461461
//this is merely a default now and can be changed at runtime
462462
#ifndef LEDPIN
463-
#if defined(ESP8266) || (defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)) || defined(CONFIG_IDF_TARGET_ESP32C3)
464-
#define LEDPIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards
463+
#if defined(ESP8266) || (defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_PSRAM)) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(ARDUINO_ESP32_PICO)
464+
#define LEDPIN 2 // GPIO2 (D4) on Wemos D1 mini compatible boards, and on boards where GPIO16 is not available
465465
#else
466466
#define LEDPIN 16 // aligns with GPIO2 (D4) on Wemos D1 mini32 compatible boards
467467
#endif

wled00/wled.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ void WLED::setup()
374374
#else
375375
DEBUG_PRINTLN(F("PSRAM not used."));
376376
#endif
377+
#endif
378+
#if defined(ARDUINO_ESP32_PICO)
379+
// special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM)
380+
managed_pin_type pins[] = { {16, true}, {17, true} };
381+
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
377382
#endif
378383

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

0 commit comments

Comments
 (0)