mirror of https://github.com/arendst/Tasmota.git
Phase 1 support C2/C6
This commit is contained in:
parent
0c3b559630
commit
37a527696a
|
@ -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) {
|
|||
"<hr/>"));
|
||||
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
|
||||
#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
|
||||
// ESP32C2/C3/C6 all gpios are in the template, flash are hidden
|
||||
bool hidden = FlashPin(i);
|
||||
WSContentSend_P(PSTR("<tr%s><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d' onchange='ot(%d,this.value)'></select></td>"),
|
||||
hidden ? PSTR(" hidden") : "",
|
||||
|
@ -1720,6 +1720,7 @@ 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));
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
|
@ -1734,6 +1735,24 @@ void TemplateSaveSettings(void) {
|
|||
snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(j));
|
||||
j++;
|
||||
#endif
|
||||
*/
|
||||
#ifdef ESP8266
|
||||
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 // ESP8266
|
||||
#ifdef ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6
|
||||
snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(i));
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
if (22 == i) { j = 33; } // skip 22-32
|
||||
snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(j));
|
||||
j++;
|
||||
#else // ESP32
|
||||
snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(Esp32TemplateToPhy[i]));
|
||||
#endif // ESP32C2/C3/C6 and S2/S3
|
||||
#endif // ESP32
|
||||
}
|
||||
|
||||
uint32_t flag = 0;
|
||||
|
|
Loading…
Reference in New Issue