Skip to content

Commit 0937064

Browse files
committed
fix pin availability calculations for ESP32-mini modules
1 parent 6a1d3de commit 0937064

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

wled00/pin_manager.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,18 @@ bool PinManager::isPinOk(byte gpio, bool output)
214214
// JTAG: GPIO39-42 are usually used for inline debugging
215215
// GPIO46 is input only and pulled down
216216
#else
217-
if (gpio > 5 && gpio < 12) return false; //SPI flash pins
217+
218+
if (strncmp_P(PSTR("ESP32-U4WDH"), ESP.getChipModel(), 11) == 0) {
219+
// this chip has 4 MB of internal Flash and different packaging, so available pins are different!
220+
if ((gpio == 1) || (gpio == 3) || ((gpio >= 6) && (gpio =< 8)) ||
221+
(gpio == 11) || (gpio == 16) || (gpio == 17) || (gpio == 20) ||
222+
(gpio == 24) || ((gpio >= 28) && (gpio <= 31)))
223+
return false;
224+
} else {
225+
// for classic ESP32 (non-mini) modules, these are the SPI flash pins
226+
if (gpio > 5 && gpio < 12) return false; //SPI flash pins
227+
}
228+
218229
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
219230
if (gpio == 16 || gpio == 17) return !psramFound(); //PSRAM pins on ESP32 (these are IO)
220231
#endif

0 commit comments

Comments
 (0)