Skip to content

Commit b4aa6a1

Browse files
committed
Merge pull request wled#4450 from adafruit/main
Add correct pin availability for ESP32 Mini modules
1 parent da8f907 commit b4aa6a1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

wled00/pin_manager.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,22 @@ bool PinManagerClass::isPinOk(byte gpio, bool output) const
755755
// JTAG: GPIO39-42 are usually used for inline debugging
756756
// GPIO46 is input only and pulled down
757757
#else
758-
if (gpio > 5 && gpio < 12) return false; //SPI flash pins
758+
if ((gpio > 5 && gpio < 12) && // WLEDMM slightly faster to first check for "potentially reserved pins" and then call ESP.getChipModel()
759+
((strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0) || // this is the correct identifier, but....
760+
(strncmp_P(PSTR("ESP32-PICO-D2"), ESP.getChipModel(), 13) == 0))) // https://github.com/espressif/arduino-esp32/issues/10683
761+
{
762+
// this chip has 4 MB of internal Flash and different packaging, so available pins are different!
763+
if (((gpio > 5) && (gpio < 9)) || (gpio == 11))
764+
return false;
765+
} else {
766+
// for classic ESP32 (non-mini) modules, these are the SPI flash pins
767+
if (gpio > 5 && gpio < 12) return false; //SPI flash pins
768+
}
769+
//WLEDMM gpio 16/17 (PSRAM or SPI FLASH) are handled differently
770+
// if (((strncmp_P(PSTR("ESP32-PICO"), ESP.getChipModel(), 10) == 0) ||
771+
// (strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0))
772+
// && (gpio == 16 || gpio == 17)) return false; // PICO-D4/U4WDH: gpio16+17 are in use for onboard SPI FLASH
773+
// if (gpio == 16 || gpio == 17) return !psramFound(); //PSRAM pins on ESP32 (these are IO)
759774
#endif
760775
if (output) return digitalPinCanOutput(gpio);
761776
else return true;

0 commit comments

Comments
 (0)