diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index cdbb85267..0c9f32e84 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -100,7 +100,8 @@ bool PinManager::allocateMultiplePins(const managed_pin_type * mptArray, byte ar // as this can greatly simplify configuration arrays continue; } - if (!isPinOk(gpio, mptArray[i].isOutput)) { + // allow any GPIO for Ethernet (compile time assigned) + if (!(isPinOk(gpio, mptArray[i].isOutput) || tag==PinOwner::Ethernet)) { DEBUG_PRINTF_P(PSTR("PIN ALLOC: FAIL Invalid pin attempted to be allocated: GPIO %d as %s\n."), gpio, mptArray[i].isOutput ? PSTR("output"): PSTR("input")); shouldFail = true; } @@ -228,19 +229,18 @@ bool PinManager::isPinOk(byte gpio, bool output) #else 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 + (strncmp_P(PSTR("ESP32-PICO-D"), ESP.getChipModel(), 12) == 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 > 5) && (gpio < 9)) || (gpio == 11)) - return false; + if ((gpio > 5 && gpio < 9) || gpio == 11) return false; // U4WDH/PICO-D2 & PICO-D4: GPIO 6, 7, 8, 11 are used for SPI flash; 9 & 10 are free + if (gpio == 16 || gpio == 17) return false; // U4WDH/PICO-D?: GPIO 16 and 17 are used for PSRAM + } else if (strncmp_P(PSTR("ESP32-PICO-V3"), ESP.getChipModel(), 13) == 0) { + if (gpio == 6 || gpio == 11) return false; // PICO-V3: uses GPIO 6 and 11 for flash + if (strstr_P(ESP.getChipModel(), PSTR("V3-02")) != nullptr && (gpio == 9 || gpio == 10)) return false; // PICO-V3-02: uses GPIO 9 and 10 for PSRAM; 7, 8 are free } 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) || - (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) + if (gpio == 16 || gpio == 17) return !psramFound(); // PSRAM pins on ESP32-D0WDR2-V3 (these are IO) #endif if (output) return digitalPinCanOutput(gpio); else return true;