mirror of https://github.com/arendst/Tasmota.git
Add features to ESP32
- Decided to support ONLY flash mode DOUT (no software change but allows for RX1/TX1) - Add GPIO9 (RX1) and GPIO10 (TX1) for hardware serial support - Add above two GPIOs to template - Moved basic ADC0 support from GPIO36 to GPIO33
This commit is contained in:
parent
48dd608da9
commit
e1d7416a36
|
@ -407,9 +407,9 @@ struct SYSCFG {
|
||||||
char ex_mqtt_fulltopic[100]; // 558
|
char ex_mqtt_fulltopic[100]; // 558
|
||||||
#else // ESP32
|
#else // ESP32
|
||||||
myio my_gp; // 558 - 40 bytes (ESP32)
|
myio my_gp; // 558 - 40 bytes (ESP32)
|
||||||
mytmplt user_template; // 580 - 35 bytes (ESP32)
|
mytmplt user_template; // 580 - 37 bytes (ESP32)
|
||||||
|
|
||||||
uint8_t free_esp32_5a3[25]; // 5A3
|
uint8_t free_esp32_5a5[23]; // 5A5
|
||||||
#endif // ESP8266 - ESP32
|
#endif // ESP8266 - ESP32
|
||||||
|
|
||||||
SysBitfield2 flag2; // 5BC
|
SysBitfield2 flag2; // 5BC
|
||||||
|
|
|
@ -1143,12 +1143,8 @@ void ModuleGpios(myio *gp)
|
||||||
|
|
||||||
uint32_t j = 0;
|
uint32_t j = 0;
|
||||||
for (uint32_t i = 0; i < sizeof(mycfgio); i++) {
|
for (uint32_t i = 0; i < sizeof(mycfgio); i++) {
|
||||||
#ifdef ESP8266
|
|
||||||
if (6 == i) { j = 9; }
|
if (6 == i) { j = 9; }
|
||||||
if (8 == i) { j = 12; }
|
if (8 == i) { j = 12; }
|
||||||
#else // ESP32
|
|
||||||
if (6 == i) { j = 12; }
|
|
||||||
#endif // ESP8266 - ESP32
|
|
||||||
dest[j] = src[i];
|
dest[j] = src[i];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
@ -1203,12 +1199,7 @@ void SetModuleType(void)
|
||||||
|
|
||||||
bool FlashPin(uint32_t pin)
|
bool FlashPin(uint32_t pin)
|
||||||
{
|
{
|
||||||
#ifdef ESP8266
|
|
||||||
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
return (((pin > 5) && (pin < 9)) || (11 == pin));
|
||||||
#endif // ESP8266
|
|
||||||
#ifdef ESP32
|
|
||||||
return ((pin > 5) && (pin < 12));
|
|
||||||
#endif // ESP32
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ValidPin(uint32_t pin, uint32_t gpio)
|
uint8_t ValidPin(uint32_t pin, uint32_t gpio)
|
||||||
|
|
|
@ -1114,12 +1114,8 @@ void CmndTemplate(void)
|
||||||
SettingsUpdateText(SET_TEMPLATE_NAME, "Merged");
|
SettingsUpdateText(SET_TEMPLATE_NAME, "Merged");
|
||||||
uint32_t j = 0;
|
uint32_t j = 0;
|
||||||
for (uint32_t i = 0; i < sizeof(mycfgio); i++) {
|
for (uint32_t i = 0; i < sizeof(mycfgio); i++) {
|
||||||
#ifdef ESP8266
|
|
||||||
if (6 == i) { j = 9; }
|
if (6 == i) { j = 9; }
|
||||||
if (8 == i) { j = 12; }
|
if (8 == i) { j = 12; }
|
||||||
#else // ESP32
|
|
||||||
if (6 == i) { j = 12; }
|
|
||||||
#endif // ESP8266 - ESP32
|
|
||||||
if (my_module.io[j] > GPIO_NONE) {
|
if (my_module.io[j] > GPIO_NONE) {
|
||||||
Settings.user_template.gp.io[i] = my_module.io[j];
|
Settings.user_template.gp.io[i] = my_module.io[j];
|
||||||
}
|
}
|
||||||
|
|
|
@ -713,11 +713,12 @@ const char PINS_WEMOS[] PROGMEM = "D3TXD4RXD2D1flashcFLFLolD6D7D5D8D0A0";
|
||||||
// esp32 has more pins
|
// esp32 has more pins
|
||||||
#define USER_MODULE 255
|
#define USER_MODULE 255
|
||||||
#define MAX_GPIO_PIN 40 // Number of supported GPIO
|
#define MAX_GPIO_PIN 40 // Number of supported GPIO
|
||||||
#define MIN_FLASH_PINS 6 // Number of flash chip pins unusable for configuration (GPIO6, 7, 8, 9, 10 and 11)
|
#define MIN_FLASH_PINS 4 // Number of flash chip pins unusable for configuration (GPIO6, 7, 8 and 11)
|
||||||
#define ADC0_PIN 36 // Pin number of ADC0
|
#define ADC0_PIN 33 // Pin number of ADC0
|
||||||
#define WEMOS_MODULE 0 // Wemos module
|
#define WEMOS_MODULE 0 // Wemos module
|
||||||
|
|
||||||
const char PINS_WEMOS[] PROGMEM = "00TX02RX04050607080910111213141516171819202122232425262728293031A4A5A6A7A03738A3";
|
//const char PINS_WEMOS[] PROGMEM = "00TX02RX0405060708R1T11112131415R2T21819202122232425262728293031A4A5A6A7A03738A3";
|
||||||
|
const char PINS_WEMOS[] PROGMEM = "I00TX0I02RX0I04I05I06I07I08RX1TX1I11I12I13I14I15RX2TX2I18I19I20I21I22I23I24I25I26I27I28I29I30I31AD4AD5AD6AD7AD0I37I38AD3";
|
||||||
|
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ const mytmplt kModules PROGMEM =
|
||||||
//6 IO GPIO6, Flash CLK
|
//6 IO GPIO6, Flash CLK
|
||||||
//7 IO GPIO7, Flash D0
|
//7 IO GPIO7, Flash D0
|
||||||
//8 IO GPIO8, Flash D1
|
//8 IO GPIO8, Flash D1
|
||||||
//9 IO GPIO9, Flash D2
|
GPIO_USER, //9 IO GPIO9, Flash D2, U1RXD
|
||||||
//10 IO GPIO10, Flash D3
|
GPIO_USER, //10 IO GPIO10, Flash D3, U1TXD
|
||||||
//11 IO GPIO11, Flash CMD
|
//11 IO GPIO11, Flash CMD
|
||||||
GPIO_USER, //12 (I)O GPIO12, ADC2_CH5, TOUCH5, RTC_GPIO15, MTDI, HSPIQ, HS2_DATA2, SD_DATA2, EMAC_TXD3 (If driven High, flash voltage (VDD_SDIO) is 1.8V not default 3.3V. Has internal pull-down, so unconnected = Low = 3.3V. May prevent flashing and/or booting if 3.3V flash is connected and pulled high. See ESP32 datasheet for more details.)
|
GPIO_USER, //12 (I)O GPIO12, ADC2_CH5, TOUCH5, RTC_GPIO15, MTDI, HSPIQ, HS2_DATA2, SD_DATA2, EMAC_TXD3 (If driven High, flash voltage (VDD_SDIO) is 1.8V not default 3.3V. Has internal pull-down, so unconnected = Low = 3.3V. May prevent flashing and/or booting if 3.3V flash is connected and pulled high. See ESP32 datasheet for more details.)
|
||||||
GPIO_USER, //13 IO GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER
|
GPIO_USER, //13 IO GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER
|
||||||
|
|
|
@ -262,12 +262,8 @@ const char HTTP_SCRIPT_TEMPLATE[] PROGMEM =
|
||||||
"g=o.shift().split(',');" // Array separator
|
"g=o.shift().split(',');" // Array separator
|
||||||
"j=0;"
|
"j=0;"
|
||||||
"for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Supports 13 GPIOs
|
"for(i=0;i<" STR(MAX_USER_PINS) ";i++){" // Supports 13 GPIOs
|
||||||
#ifdef ESP8266
|
|
||||||
"if(6==i){j=9;}"
|
"if(6==i){j=9;}"
|
||||||
"if(8==i){j=12;}"
|
"if(8==i){j=12;}"
|
||||||
#else // ESP32
|
|
||||||
"if(6==i){j=12;}"
|
|
||||||
#endif // ESP8266 - ESP32
|
|
||||||
"sk(g[i],j);" // Set GPIO
|
"sk(g[i],j);" // Set GPIO
|
||||||
"j++;"
|
"j++;"
|
||||||
"}"
|
"}"
|
||||||
|
@ -1523,12 +1519,8 @@ void TemplateSaveSettings(void)
|
||||||
|
|
||||||
uint32_t j = 0;
|
uint32_t j = 0;
|
||||||
for (uint32_t i = 0; i < sizeof(Settings.user_template.gp); i++) {
|
for (uint32_t i = 0; i < sizeof(Settings.user_template.gp); i++) {
|
||||||
#ifdef ESP8266
|
|
||||||
if (6 == i) { j = 9; }
|
if (6 == i) { j = 9; }
|
||||||
if (8 == i) { j = 12; }
|
if (8 == i) { j = 12; }
|
||||||
#else // ESP32
|
|
||||||
if (6 == i) { j = 12; }
|
|
||||||
#endif // ESP8266 - ESP32
|
|
||||||
snprintf_P(webindex, sizeof(webindex), PSTR("g%d"), j);
|
snprintf_P(webindex, sizeof(webindex), PSTR("g%d"), j);
|
||||||
WebGetArg(webindex, tmp, sizeof(tmp)); // GPIO
|
WebGetArg(webindex, tmp, sizeof(tmp)); // GPIO
|
||||||
uint8_t gpio = atoi(tmp);
|
uint8_t gpio = atoi(tmp);
|
||||||
|
@ -1622,13 +1614,14 @@ void HandleModuleConfiguration(void)
|
||||||
WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str());
|
WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str());
|
||||||
for (uint32_t i = 0; i < sizeof(cmodule); i++) {
|
for (uint32_t i = 0; i < sizeof(cmodule); i++) {
|
||||||
if (ValidGPIO(i, cmodule.io[i])) {
|
if (ValidGPIO(i, cmodule.io[i])) {
|
||||||
snprintf_P(stemp, 3, PINS_WEMOS +i*2);
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
snprintf_P(stemp, 3, PINS_WEMOS +i*2);
|
||||||
char sesp8285[40];
|
char sesp8285[40];
|
||||||
snprintf_P(sesp8285, sizeof(sesp8285), PSTR("<font color='#%06x'>ESP8285</font>"), WebColor(COL_TEXT_WARNING));
|
snprintf_P(sesp8285, sizeof(sesp8285), PSTR("<font color='#%06x'>ESP8285</font>"), WebColor(COL_TEXT_WARNING));
|
||||||
WSContentSend_P(PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:176px'><select id='g%d'></select></td></tr>"),
|
WSContentSend_P(PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:176px'><select id='g%d'></select></td></tr>"),
|
||||||
(WEMOS==my_module_type)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :((9==i)||(10==i))? sesp8285 :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i);
|
(WEMOS==my_module_type)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :((9==i)||(10==i))? sesp8285 :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i);
|
||||||
#else // ESP32
|
#else // ESP32
|
||||||
|
snprintf_P(stemp, 4, PINS_WEMOS +i*3);
|
||||||
WSContentSend_P(PSTR("<tr><td style='width:140px'>%s <b>" D_GPIO "%d</b></td><td style='width:176px'><select id='g%d'></select></td></tr>"),
|
WSContentSend_P(PSTR("<tr><td style='width:140px'>%s <b>" D_GPIO "%d</b></td><td style='width:176px'><select id='g%d'></select></td></tr>"),
|
||||||
(WEMOS==my_module_type)?stemp:"", i, i);
|
(WEMOS==my_module_type)?stemp:"", i, i);
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
|
|
Loading…
Reference in New Issue