diff --git a/tasmota/support.ino b/tasmota/support.ino index dd85c9f07..16852a565 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -1540,12 +1540,13 @@ void TemplateGpios(myio *gp) uint32_t j = 0; for (uint32_t i = 0; i < nitems(Settings->user_template.gp.io); i++) { #if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 + dest[i] = src[i]; #else if (6 == i) { j = 9; } if (8 == i) { j = 12; } -#endif dest[j] = src[i]; j++; +#endif } // 11 85 00 85 85 00 00 00 00 00 00 00 15 38 85 00 00 81 diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 8978a473e..e92650fe9 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -147,11 +147,8 @@ const char HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX[] PROGMEM = #if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = - "j=0;" - "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Skip GPIO 11-17 - "if(11==i){j=18;}" - "sk(g[i],j);" // Set GPIO - "j++;" + "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" + "sk(g[i],i);" // Set GPIO "}"; #else // Now ESP32 and ESP8266 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = @@ -1547,9 +1544,14 @@ void HandleTemplateConfiguration(void) { WSContentBegin(200, CT_PLAIN); WSContentSend_P(PSTR("%s}1"), AnyModuleName(module).c_str()); // NAME: Generic for (uint32_t i = 0; i < nitems(template_gp.io); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255 +#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 + // ESP32C3 we always send all GPIOs, Flash are just hidden + WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); +#else if (!FlashPin(i)) { WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); } +#endif } WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings->user_template_base); // FLAG: 1 BASE: 17 WSContentEnd(); @@ -1590,11 +1592,20 @@ void HandleTemplateConfiguration(void) { "
")); WSContentSend_P(HTTP_TABLE100); for (uint32_t i = 0; i < MAX_GPIO_PIN; i++) { +#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 + // ESP32C3 all gpios are in the template, flash are hidden + bool hidden = FlashPin(i); + WSContentSend_P(PSTR("" D_GPIO "%d"), + hidden ? PSTR(" hidden") : "", + RedPin(i) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i); + WSContentSend_P(PSTR(""), i); +#else if (!FlashPin(i)) { WSContentSend_P(PSTR("" D_GPIO "%d"), RedPin(i) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i); WSContentSend_P(PSTR(""), i); } +#endif } WSContentSend_P(PSTR("")); @@ -1632,10 +1643,14 @@ void TemplateSaveSettings(void) { uint32_t j = 0; for (uint32_t i = 0; i < nitems(Settings->user_template.gp.io); i++) { +#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 + snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(i)); +#else if (6 == i) { j = 9; } if (8 == i) { j = 12; } snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(j)); j++; +#endif } uint32_t flag = 0;