Skip to content

Commit 06f9474

Browse files
committed
pico board: always protect pin 16+17
runtime detection of PICO boards, to ensure that SPIRAM pins are protected even when users install a non-pico firmware build.
1 parent 1d5f029 commit 06f9474

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

wled00/wled.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,12 @@ void WLED::setup()
611611
DEBUG_PRINTLN(F("PSRAM not used."));
612612
#endif
613613
#endif
614-
#if defined(ARDUINO_ESP32_PICO)
615-
// special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM)
616-
managed_pin_type pins[] = { {16, true}, {17, true} };
617-
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
614+
#if defined(ARDUINO_ARCH_ESP32)
615+
if (strncmp("ESP32-PICO", ESP.getChipModel(), 10) == 0) { // WLEDMM detect pico board at runtime
616+
// special handling for PICO-D4: gpio16+17 are in use for onboard SPI FLASH (not PSRAM)
617+
managed_pin_type pins[] = { {16, true}, {17, true} };
618+
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
619+
}
618620
#endif
619621

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

0 commit comments

Comments
 (0)