diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 09b2ee517..12faaebd6 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1271,7 +1271,7 @@ void WS2812FX::finalizeInit() { bool clash; do { clash = false; - for (const auto pin : defDataPins) { + for (const auto &pin : defDataPins) { if (pin == defPin[j]) { defPin[j]++; if (defPin[j] < WLED_NUM_PINS) clash = true; diff --git a/wled00/xml.cpp b/wled00/xml.cpp index 338e795d4..079c0a91b 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -121,6 +121,7 @@ void fillUMPins(JsonObject &mods) void appendGPIOinfo() { char nS[8]; + // add usermod pins as d.um_p array oappend(SET_F("d.um_p=[-1")); // has to have 1 element if (i2c_sda > -1 && i2c_scl > -1) { oappend(","); oappend(itoa(i2c_sda,nS,10)); @@ -140,54 +141,41 @@ void appendGPIOinfo() { } oappend(SET_F("];")); - // add reserved and usermod pins as d.um_p array - #if defined(CONFIG_IDF_TARGET_ESP32S2) - oappend(SET_F("d.rsvd=[22,23,24,25,26,27,28,29,30,31,32")); - #elif defined(CONFIG_IDF_TARGET_ESP32S3) - oappend(SET_F("d.rsvd=[19,20,22,23,24,25,26,27,28,29,30,31,32")); // includes 19+20 for USB OTG (JTAG) - if (psramFound()) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3. - #elif defined(CONFIG_IDF_TARGET_ESP32C3) - oappend(SET_F("d.rsvd=[11,12,13,14,15,16,17")); - #elif defined(ESP32) - oappend(SET_F("d.rsvd=[6,7,8,9,10,11,24,28,29,30,31,37,38")); - if (!pinManager.isPinOk(16,false)) oappend(SET_F(",16")); // covers PICO & WROVER - if (!pinManager.isPinOk(17,false)) oappend(SET_F(",17")); // covers PICO & WROVER - #else - oappend(SET_F("d.rsvd=[6,7,8,9,10,11")); - #endif - + // add reserved (unusable) pins + oappend(SET_F("d.rsvd=[")); + for (unsigned i = 0; i < WLED_NUM_PINS; i++) { + if (!pinManager.isPinOk(i, false)) { // include readonly pins + oappendi(i); oappend(","); + } + } #ifdef WLED_ENABLE_DMX - oappend(SET_F(",2")); // DMX hardcoded pin + oappend(SET_F("2,")); // DMX hardcoded pin #endif - #if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST) - oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10)); // debug output (TX) pin + oappend(itoa(hardwareTX,nS,10)); oappend(","); // debug output (TX) pin #endif - //Note: Using pin 3 (RX) disables Adalight / Serial JSON - #ifdef WLED_USE_ETHERNET if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) { - for (unsigned p=0; p=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_power,nS,10)); } - if (ethernetBoards[ethernetType].eth_mdc>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdc,nS,10)); } - if (ethernetBoards[ethernetType].eth_mdio>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdio,nS,10)); } - switch (ethernetBoards[ethernetType].eth_clk_mode) { + for (unsigned p=0; p=0) { oappend(itoa(ethernetBoards[ethernetType].eth_power,nS,10)); oappend(","); } + if (ethernetBoards[ethernetType].eth_mdc>=0) { oappend(itoa(ethernetBoards[ethernetType].eth_mdc,nS,10)); oappend(","); } + if (ethernetBoards[ethernetType].eth_mdio>=0) { oappend(itoa(ethernetBoards[ethernetType].eth_mdio,nS,10)); oappend(","); } + switch (ethernetBoards[ethernetType].eth_clk_mode) { case ETH_CLOCK_GPIO0_IN: case ETH_CLOCK_GPIO0_OUT: - oappend(SET_F(",0")); + oappend(SET_F("0")); break; case ETH_CLOCK_GPIO16_OUT: - oappend(SET_F(",16")); + oappend(SET_F("16")); break; case ETH_CLOCK_GPIO17_OUT: - oappend(SET_F(",17")); + oappend(SET_F("17")); break; } } #endif - - oappend(SET_F("];")); + oappend(SET_F("];")); // rsvd // add info for read-only GPIO oappend(SET_F("d.ro_gpio=["));