From 37a527696a040e7af0a3de1a3534f37ed93da7b6 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:18:21 +0200 Subject: [PATCH] Phase 1 support C2/C6 --- .../xdrv_01_9_webserver.ino | 81 ++++++++++++------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 31339e392..50c959aac 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -139,28 +139,7 @@ const char HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX[] PROGMEM = #include "./html_uncompressed/HTTP_SCRIPT_TEMPLATE.h" #endif -#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32C3 -const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = - "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" - "sk(g[i],i);" // Set GPIO - "}"; -#elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) -const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = - "j=0;" - "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Skip 22-32 - "if(22==i){j=33;}" - "sk(g[i],j);" // Set GPIO - "j++;" - "}"; -#elif defined(CONFIG_IDF_TARGET_ESP32) -const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = - "j=0;" - "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Skip 28-31 - "if(28==i){j=32;}" - "sk(g[i],j);" // Set GPIO - "j++;" - "}"; -#else // ESP8266 +#ifdef ESP8266 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "j=0;" "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Supports 13 GPIOs @@ -169,7 +148,32 @@ const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "sk(g[i],j);" // Set GPIO "j++;" "}"; -#endif +#endif // ESP8266 +#ifdef ESP32 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = + "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" + "sk(g[i],i);" // Set GPIO + "}"; +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = + "j=0;" + "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Skip 22-32 + "if(22==i){j=33;}" + "sk(g[i],j);" // Set GPIO + "j++;" + "}"; +#else // ESP32 +const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = + "j=0;" + "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Skip 28-31 + "if(28==i){j=32;}" + "sk(g[i],j);" // Set GPIO + "j++;" + "}"; +#endif // Non plain ESP32 +#endif // ESP32 + const char HTTP_SCRIPT_TEMPLATE3[] PROGMEM = "\";" "sk(g[13]," STR(ADC0_PIN) ");"; // Set ADC0 @@ -1617,13 +1621,9 @@ 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 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 + // ESP32C2/C3/C6 we always send all GPIOs, Flash are just hidden WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); -#elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) - if (!FlashPin(i)) { - 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]); @@ -1669,8 +1669,8 @@ void HandleTemplateConfiguration(void) { "