From dcf89e0dbd428c6cb658e94854edd2969590f4ee Mon Sep 17 00:00:00 2001 From: ladyada Date: Fri, 3 Jan 2025 16:37:26 -0500 Subject: [PATCH] simplify logic --- wled00/pin_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index aa2dcf069d..c37b193674 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -218,16 +218,16 @@ bool PinManager::isPinOk(byte gpio, bool output) if ((strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0) || // this is the correct identifier, but.... (strncmp_P(PSTR("ESP32-PICO-D2"), ESP.getChipModel(), 13) == 0)) { // https://github.com/espressif/arduino-esp32/issues/10683 // this chip has 4 MB of internal Flash and different packaging, so available pins are different! - if ((gpio == 1) || (gpio == 3) || ((gpio >= 6) && (gpio <= 8)) || - (gpio == 11) || (gpio == 16) || (gpio == 17) || (gpio == 20) || - (gpio == 24) || ((gpio >= 28) && (gpio <= 31))) + if (((gpio > 5) && (gpio < 9)) || (gpio == 11)) return false; } else { // for classic ESP32 (non-mini) modules, these are the SPI flash pins if (gpio > 5 && gpio < 12) return false; //SPI flash pins } - if (strncmp_P(PSTR("ESP32-PICO"), ESP.getChipModel(), 10) == 0 && (gpio == 16 || gpio == 17)) return false; // PICO-D4: gpio16+17 are in use for onboard SPI FLASH + if (((strncmp_P(PSTR("ESP32-PICO"), ESP.getChipModel(), 10) == 0) || + (strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0)) + && (gpio == 16 || gpio == 17)) return false; // PICO-D4/U4WDH: gpio16+17 are in use for onboard SPI FLASH if (gpio == 16 || gpio == 17) return !psramFound(); //PSRAM pins on ESP32 (these are IO) #endif if (output) return digitalPinCanOutput(gpio);