mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Add experimental basic support for ESP32
- Add experimental basic support for Tasmota on ESP32 based on work by Jörg Schüler-Maroldt - Bump version to 8.2.0.6 - This ESP32 upgrade breaks current ESP32 templates
This commit is contained in:
parent
7177c7d8e0
commit
5d18ad1c74
@ -96,3 +96,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||
- Add console command history (#7483, #8015)
|
||||
- Add quick wifi reconnect using saved AP parameters when ``SetOption56 0`` (#3189)
|
||||
- Add more accuracy to GPS NTP server (#8088)
|
||||
- Add experimental basic support for Tasmota on ESP32 based on work by Jörg Schüler-Maroldt
|
||||
|
@ -1,5 +1,9 @@
|
||||
## Unreleased (development)
|
||||
|
||||
### 8.2.0.6 20200501
|
||||
|
||||
- Add experimental basic support for Tasmota on ESP32 based on work by Jörg Schüler-Maroldt
|
||||
|
||||
### 8.2.0.5 20200425
|
||||
|
||||
- Breaking Change Device Groups multicast address and port (#8270)
|
||||
|
@ -362,15 +362,10 @@ struct {
|
||||
char ex_friendlyname[4][33]; // 3AC
|
||||
char ex_switch_topic[33]; // 430
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
char ex_friendlyname[4][33]; // 3AC
|
||||
char ex_switch_topic[33]; // 430
|
||||
#else // FINAL_ESP32
|
||||
myio my_gp; // 3AC - 2 x 40 bytes (ESP32)
|
||||
mytmplt user_template; // 3FC - 2 x 37 bytes (ESP32)
|
||||
|
||||
uint8_t free_esp32_446[11]; // 446
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
char serial_delimiter; // 451
|
||||
@ -415,18 +410,7 @@ struct {
|
||||
uint32_t ip_address[4]; // 544
|
||||
unsigned long energy_kWhtotal; // 554
|
||||
|
||||
#ifdef ESP8266
|
||||
char ex_mqtt_fulltopic[100]; // 558
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
myio my_gp; // 558 - 40 bytes (ESP32)
|
||||
mytmplt user_template; // 580 - 37 bytes (ESP32)
|
||||
|
||||
uint8_t free_esp32_5a5[23]; // 5A5
|
||||
#else // FINAL_ESP32
|
||||
char ex_mqtt_fulltopic[100]; // 558
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
SysBitfield2 flag2; // 5BC
|
||||
unsigned long pulse_counter[MAX_COUNTERS]; // 5C0
|
||||
|
@ -1386,6 +1386,13 @@ void SettingsDelta(void)
|
||||
#endif // ESP32
|
||||
}
|
||||
|
||||
if (Settings.version < 0x08020006) {
|
||||
#ifdef ESP32
|
||||
Settings.module = WEMOS;
|
||||
ModuleDefault(WEMOS);
|
||||
#endif // ESP32
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
}
|
||||
|
@ -1085,11 +1085,7 @@ uint32_t Pin(uint32_t gpio, uint32_t index) {
|
||||
#ifdef ESP8266
|
||||
uint16_t real_gpio = gpio + index;
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint16_t real_gpio = gpio + index;
|
||||
#else // FINAL_ESP32
|
||||
uint16_t real_gpio = (gpio << 5) + index;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(gpio_pin); i++) {
|
||||
if (gpio_pin[i] == real_gpio) {
|
||||
@ -1172,13 +1168,8 @@ void ModuleGpios(myio *gp)
|
||||
uint8_t *dest = (uint8_t *)gp;
|
||||
uint8_t src[ARRAY_SIZE(Settings.user_template.gp.io)];
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint8_t *dest = (uint8_t *)gp;
|
||||
uint8_t src[ARRAY_SIZE(Settings.user_template.gp.io)];
|
||||
#else // FINAL_ESP32
|
||||
uint16_t *dest = (uint16_t *)gp;
|
||||
uint16_t src[ARRAY_SIZE(Settings.user_template.gp.io)];
|
||||
#endif
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
memset(dest, GPIO_NONE, sizeof(myio));
|
||||
@ -1268,11 +1259,7 @@ bool ValidGPIO(uint32_t pin, uint32_t gpio)
|
||||
#ifdef ESP8266
|
||||
return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
|
||||
#else // FINAL_ESP32
|
||||
return (GPIO_USER == ValidPin(pin, gpio >> 5)); // Only allow GPIO_USER pins
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
|
||||
@ -1288,11 +1275,7 @@ bool ValidAdc(void)
|
||||
#ifdef ESP8266
|
||||
bool GetUsedInModule(uint32_t val, uint8_t *arr)
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
bool GetUsedInModule(uint32_t val, uint8_t *arr)
|
||||
#else // FINAL_ESP32
|
||||
bool GetUsedInModule(uint32_t val, uint16_t *arr)
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
{
|
||||
int offset = 0;
|
||||
|
@ -1055,19 +1055,11 @@ void CmndGpio(void)
|
||||
break;
|
||||
}
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
if (midx == XdrvMailbox.payload) {
|
||||
present = true;
|
||||
break;
|
||||
}
|
||||
#else // FINAL_ESP32
|
||||
uint32_t midx = pgm_read_word(kGpioNiceList + i);
|
||||
if ((XdrvMailbox.payload >= (midx & 0xFFE0)) && (XdrvMailbox.payload < midx)) {
|
||||
present = true;
|
||||
break;
|
||||
}
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
}
|
||||
if (present) {
|
||||
@ -1097,9 +1089,6 @@ void CmndGpio(void)
|
||||
#ifdef ESP8266
|
||||
uint32_t sensor_name_idx = sensor_type;
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint32_t sensor_name_idx = sensor_type;
|
||||
#else // FINAL_ESP32
|
||||
uint32_t sensor_name_idx = sensor_type >> 5;
|
||||
uint32_t nice_list_search = sensor_type & 0xFFE0;
|
||||
for (uint32_t j = 0; j < ARRAY_SIZE(kGpioNiceList); j++) {
|
||||
@ -1109,7 +1098,6 @@ void CmndGpio(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
const char *sensor_names = kSensorNames;
|
||||
if (sensor_name_idx > GPIO_FIX_START) {
|
||||
@ -1140,13 +1128,8 @@ void CmndGpios(void)
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // FINAL_ESP32
|
||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||
uint32_t midx = ridx >> 5;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; }
|
||||
if (!jsflg) {
|
||||
|
@ -120,9 +120,7 @@ uint16_t seriallog_timer = 0; // Timer to disable Seriallog
|
||||
uint16_t syslog_timer = 0; // Timer to re-enable syslog_level
|
||||
|
||||
#ifdef ESP32
|
||||
#ifdef FINAL_ESP32
|
||||
uint16_t gpio_pin[MAX_GPIO_PIN] = { 0 }; // GPIO functions indexed by pin number
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP32
|
||||
|
||||
int16_t save_data_counter; // Counter and flag for config save to Flash
|
||||
@ -140,14 +138,6 @@ uint8_t pin_gpio[GPIO_MAX]; // Pin numbers indexed by GPIO funct
|
||||
#else // No LEGACY_GPIO_ARRAY
|
||||
uint8_t gpio_pin[MAX_GPIO_PIN] = { 0 }; // GPIO functions indexed by pin number
|
||||
#endif // LEGACY_GPIO_ARRAY
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
#ifdef LEGACY_GPIO_ARRAY
|
||||
uint8_t pin_gpio[GPIO_MAX]; // Pin numbers indexed by GPIO function
|
||||
#else // No LEGACY_GPIO_ARRAY
|
||||
uint8_t gpio_pin[MAX_GPIO_PIN] = { 0 }; // GPIO functions indexed by pin number
|
||||
#endif // LEGACY_GPIO_ARRAY
|
||||
#endif // No FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
uint8_t active_device = 1; // Active device in ExecuteCommandPower
|
||||
|
@ -55,11 +55,6 @@ extern "C" void resetPins();
|
||||
|
||||
//#define LEGACY_GPIO_ARRAY // Uncomment to use legacy GPIO array instead of new PIN array
|
||||
|
||||
//#define FINAL_ESP32 // Uncomment for ESP32 16-bits PIN array
|
||||
#ifdef FINAL_ESP32
|
||||
#undef LEGACY_GPIO_ARRAY
|
||||
#endif
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Mandatory defines satisfying disabled defines
|
||||
\*********************************************************************************************/
|
||||
@ -336,11 +331,7 @@ const char kWebColors[] PROGMEM =
|
||||
#ifdef ESP8266
|
||||
#define AGPIO(x) (x)
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
#define AGPIO(x) (x)
|
||||
#else // FINAL_ESP32
|
||||
#define AGPIO(x) (x<<5)
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,707 +0,0 @@
|
||||
/*
|
||||
tasmota_template_ESP32_final.h - template settings for Tasmota
|
||||
|
||||
Copyright (C) 2020 Theo Arends
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TASMOTA_TEMPLATE_ESP32_FINAL_H_
|
||||
#define _TASMOTA_TEMPLATE_ESP32_FINAL_H_
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
// Hardware has no ESP32
|
||||
#undef USE_TUYA_DIMMER
|
||||
#undef USE_PWM_DIMMER
|
||||
#undef USE_EXS_DIMMER
|
||||
#undef USE_ARMTRONIX_DIMMERS
|
||||
#undef USE_SONOFF_RF
|
||||
#undef USE_SONOFF_SC
|
||||
#undef USE_SONOFF_IFAN
|
||||
#undef USE_SONOFF_L1
|
||||
#undef USE_SONOFF_D1
|
||||
#undef USE_RF_FLASH
|
||||
|
||||
// Not ported (yet)
|
||||
#undef USE_DISCOVERY
|
||||
#undef USE_ADC_VCC // Needs to be ported
|
||||
#undef USE_DEEPSLEEP
|
||||
#undef USE_MY92X1
|
||||
#undef USE_TUYA_MCU
|
||||
#undef USE_PS_16_DZ
|
||||
|
||||
enum UserSelectablePins {
|
||||
GPIO_NONE, // Not used
|
||||
GPIO_KEY1, // 4 x Button usually connected to GPIO0
|
||||
GPIO_KEY1_NP,
|
||||
GPIO_KEY1_INV,
|
||||
GPIO_KEY1_INV_NP,
|
||||
GPIO_SWT1, // 8 x User connected external switches
|
||||
GPIO_SWT1_NP,
|
||||
GPIO_REL1, // 8 x Relays
|
||||
GPIO_REL1_INV,
|
||||
GPIO_LED1, // 4 x Leds
|
||||
GPIO_LED1_INV,
|
||||
GPIO_CNTR1, // 4 x Counter
|
||||
GPIO_CNTR1_NP,
|
||||
GPIO_PWM1, // 5 x PWM
|
||||
GPIO_PWM1_INV,
|
||||
GPIO_BUZZER, // Buzzer
|
||||
GPIO_BUZZER_INV, // Inverted buzzer
|
||||
GPIO_LEDLNK, // Link led
|
||||
GPIO_LEDLNK_INV, // Inverted link led
|
||||
GPIO_I2C_SCL, // I2C SCL
|
||||
GPIO_I2C_SDA, // I2C SDA
|
||||
GPIO_SPI_MISO, // SPI MISO
|
||||
GPIO_SPI_MOSI, // SPI MOSI
|
||||
GPIO_SPI_CLK, // SPI Clk
|
||||
GPIO_SPI_CS, // SPI Chip Select
|
||||
GPIO_SPI_DC, // SPI Data Direction
|
||||
GPIO_SSPI_MISO, // Software SPI Master Input Slave Output
|
||||
GPIO_SSPI_MOSI, // Software SPI Master Output Slave Input
|
||||
GPIO_SSPI_SCLK, // Software SPI Serial Clock
|
||||
GPIO_SSPI_CS, // Software SPI Chip Select
|
||||
GPIO_SSPI_DC, // Software SPI Data or Command
|
||||
GPIO_BACKLIGHT, // Display backlight control
|
||||
GPIO_OLED_RESET, // OLED Display Reset
|
||||
GPIO_IRSEND, // IR remote
|
||||
GPIO_IRRECV, // IR receiver
|
||||
GPIO_RFSEND, // RF transmitter
|
||||
GPIO_RFRECV, // RF receiver
|
||||
GPIO_DHT11, // DHT11
|
||||
GPIO_DHT22, // DHT21, DHT22, AM2301, AM2302, AM2321
|
||||
GPIO_SI7021, // iTead SI7021
|
||||
GPIO_DHT11_OUT, // Pseudo Single wire DHT11, DHT21, DHT22, AM2301, AM2302, AM2321
|
||||
GPIO_DSB, // Single wire DS18B20 or DS18S20
|
||||
GPIO_DSB_OUT, // Pseudo Single wire DS18B20 or DS18S20
|
||||
GPIO_WS2812, // WS2812 Led string
|
||||
GPIO_MHZ_TXD, // MH-Z19 Serial interface
|
||||
GPIO_MHZ_RXD, // MH-Z19 Serial interface
|
||||
GPIO_PZEM0XX_TX, // PZEM0XX Serial interface
|
||||
GPIO_PZEM004_RX, // PZEM004T Serial interface
|
||||
GPIO_PZEM016_RX, // PZEM-014,016 Serial Modbus interface
|
||||
GPIO_PZEM017_RX, // PZEM-003,017 Serial Modbus interface
|
||||
GPIO_SAIR_TX, // SenseAir Serial interface
|
||||
GPIO_SAIR_RX, // SenseAir Serial interface
|
||||
GPIO_PMS5003_TX, // Plantower PMS5003 Serial interface
|
||||
GPIO_PMS5003_RX, // Plantower PMS5003 Serial interface
|
||||
GPIO_SDS0X1_TX, // Nova Fitness SDS011 Serial interface
|
||||
GPIO_SDS0X1_RX, // Nova Fitness SDS011 Serial interface
|
||||
GPIO_SBR_TX, // Serial Bridge Serial interface
|
||||
GPIO_SBR_RX, // Serial Bridge Serial interface
|
||||
GPIO_SR04_TRIG, // SR04 Trigger/TX pin
|
||||
GPIO_SR04_ECHO, // SR04 Echo/RX pin
|
||||
GPIO_SDM120_TX, // SDM120 Serial interface
|
||||
GPIO_SDM120_RX, // SDM120 Serial interface
|
||||
GPIO_SDM630_TX, // SDM630 Serial interface
|
||||
GPIO_SDM630_RX, // SDM630 Serial interface
|
||||
GPIO_TM16CLK, // TM1638 Clock
|
||||
GPIO_TM16DIO, // TM1638 Data I/O
|
||||
GPIO_TM16STB, // TM1638 Strobe
|
||||
GPIO_MP3_DFR562, // RB-DFR-562, DFPlayer Mini MP3 Player
|
||||
GPIO_HX711_SCK, // HX711 Load Cell clock
|
||||
GPIO_HX711_DAT, // HX711 Load Cell data
|
||||
GPIO_TX2X_TXD_BLACK, // TX20/TX23 Transmission Pin
|
||||
GPIO_TUYA_TX, // Tuya Serial interface
|
||||
GPIO_TUYA_RX, // Tuya Serial interface
|
||||
GPIO_MGC3130_XFER, // MGC3130 Transfer
|
||||
GPIO_MGC3130_RESET, // MGC3130 Reset
|
||||
GPIO_RF_SENSOR, // Rf receiver with sensor decoding
|
||||
GPIO_AZ_TXD, // AZ-Instrument 7798 Serial interface
|
||||
GPIO_AZ_RXD, // AZ-Instrument 7798 Serial interface
|
||||
GPIO_MAX31855CS, // MAX31855 Serial interface
|
||||
GPIO_MAX31855CLK, // MAX31855 Serial interface
|
||||
GPIO_MAX31855DO, // MAX31855 Serial interface
|
||||
GPIO_NRG_SEL, // HLW8012/HLJ-01 Sel output (1 = Voltage)
|
||||
GPIO_NRG_SEL_INV, // HLW8012/HLJ-01 Sel output (0 = Voltage)
|
||||
GPIO_NRG_CF1, // HLW8012/HLJ-01 CF1 voltage / current
|
||||
GPIO_HLW_CF, // HLW8012 CF power
|
||||
GPIO_HJL_CF, // HJL-01/BL0937 CF power
|
||||
GPIO_MCP39F5_TX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RX, // MCP39F501 Serial interface (Shelly2)
|
||||
GPIO_MCP39F5_RST, // MCP39F501 Reset (Shelly2)
|
||||
GPIO_PN532_TXD, // PN532 NFC Serial Tx
|
||||
GPIO_PN532_RXD, // PN532 NFC Serial Rx
|
||||
GPIO_SM16716_CLK, // SM16716 CLOCK
|
||||
GPIO_SM16716_DAT, // SM16716 DATA
|
||||
GPIO_SM16716_SEL, // SM16716 SELECT
|
||||
GPIO_DI, // my92x1 PWM input
|
||||
GPIO_DCKI, // my92x1 CLK input
|
||||
GPIO_CSE7766_TX, // CSE7766 Serial interface (S31 and Pow R2) - Not used anymore 20200121
|
||||
GPIO_CSE7766_RX, // CSE7766 Serial interface (S31 and Pow R2)
|
||||
GPIO_ARIRFRCV, // AriLux RF Receive input
|
||||
GPIO_TXD, // Serial interface
|
||||
GPIO_RXD, // Serial interface
|
||||
GPIO_ROT1A, // Rotary switch1 A Pin
|
||||
GPIO_ROT1B, // Rotary switch1 B Pin
|
||||
GPIO_ROT2A, // Rotary switch2 A Pin
|
||||
GPIO_ROT2B, // Rotary switch2 B Pin
|
||||
GPIO_HRE_CLOCK, // Clock/Power line for HR-E Water Meter
|
||||
GPIO_HRE_DATA, // Data line for HR-E Water Meter
|
||||
GPIO_ADE7953_IRQ, // ADE7953 IRQ
|
||||
GPIO_ARIRFSEL, // Arilux RF Receive input selected
|
||||
GPIO_SOLAXX1_TX, // Solax Inverter tx pin
|
||||
GPIO_SOLAXX1_RX, // Solax Inverter rx pin
|
||||
GPIO_ZIGBEE_TX, // Zigbee Serial interface
|
||||
GPIO_ZIGBEE_RX, // Zigbee Serial interface
|
||||
GPIO_RDM6300_RX, // RDM6300 RX
|
||||
GPIO_IBEACON_TX, // HM17 IBEACON TX
|
||||
GPIO_IBEACON_RX, // HM17 IBEACON RX
|
||||
GPIO_A4988_DIR, // A4988 direction pin
|
||||
GPIO_A4988_STP, // A4988 step pin
|
||||
GPIO_A4988_ENA, // A4988 enabled pin
|
||||
GPIO_A4988_MS1, // A4988 microstep pin1
|
||||
GPIO_A4988_MS2, // A4988 microstep pin2
|
||||
GPIO_A4988_MS3, // A4988 microstep pin3
|
||||
GPIO_DDS2382_TX, // DDS2382 Serial interface
|
||||
GPIO_DDS2382_RX, // DDS2382 Serial interface
|
||||
GPIO_DDSU666_TX, // DDSU666 Serial interface
|
||||
GPIO_DDSU666_RX, // DDSU666 Serial interface
|
||||
GPIO_SM2135_CLK, // SM2135 Clk
|
||||
GPIO_SM2135_DAT, // SM2135 Dat
|
||||
GPIO_DEEPSLEEP, // Kill switch for deepsleep
|
||||
GPIO_EXS_ENABLE, // EXS MCU Enable
|
||||
GPIO_TASMOTASLAVE_TXD, // Slave TX
|
||||
GPIO_TASMOTASLAVE_RXD, // Slave RX
|
||||
GPIO_TASMOTASLAVE_RST, // Slave Reset Pin
|
||||
GPIO_TASMOTASLAVE_RST_INV, // Slave Reset Inverted
|
||||
GPIO_HPMA_RX, // Honeywell HPMA115S0 Serial interface
|
||||
GPIO_HPMA_TX, // Honeywell HPMA115S0 Serial interface
|
||||
GPIO_GPS_RX, // GPS serial interface
|
||||
GPIO_GPS_TX, // GPS serial interface
|
||||
GPIO_HM10_RX, // HM10-BLE-Mijia-bridge serial interface
|
||||
GPIO_HM10_TX, // HM10-BLE-Mijia-bridge serial interface
|
||||
GPIO_LE01MR_RX, // F&F LE-01MR energy meter
|
||||
GPIO_LE01MR_TX, // F&F LE-01MR energy meter
|
||||
GPIO_CC1101_GDO0, // CC1101 pin for RX
|
||||
GPIO_CC1101_GDO2, // CC1101 pin for RX
|
||||
GPIO_HRXL_RX, // Data from MaxBotix HRXL sonar range sensor
|
||||
GPIO_ELECTRIQ_MOODL_TX, // ElectriQ iQ-wifiMOODL Serial TX
|
||||
GPIO_AS3935,
|
||||
ADC0_INPUT, // Analog input
|
||||
ADC0_TEMP, // Thermistor
|
||||
ADC0_LIGHT, // Light sensor
|
||||
ADC0_BUTTON, // Button
|
||||
ADC0_BUTTON_INV,
|
||||
ADC0_RANGE, // Range
|
||||
ADC0_CT_POWER, // Current
|
||||
GPIO_SENSOR_END };
|
||||
|
||||
enum ProgramSelectablePins {
|
||||
// GPIO_FIX_START = 254,
|
||||
GPIO_FIX_START = 2046,
|
||||
GPIO_USER, // User configurable needs to be 2047
|
||||
GPIO_MAX };
|
||||
|
||||
// Text in webpage Module Parameters and commands GPIOS and GPIO
|
||||
const char kSensorNames[] PROGMEM =
|
||||
D_SENSOR_NONE "|"
|
||||
D_SENSOR_BUTTON "|"
|
||||
D_SENSOR_BUTTON "n|"
|
||||
D_SENSOR_BUTTON "i|"
|
||||
D_SENSOR_BUTTON "in|"
|
||||
D_SENSOR_SWITCH "|"
|
||||
D_SENSOR_SWITCH "n|"
|
||||
D_SENSOR_RELAY "|"
|
||||
D_SENSOR_RELAY "i|"
|
||||
D_SENSOR_LED "|"
|
||||
D_SENSOR_LED "i|"
|
||||
D_SENSOR_COUNTER "|"
|
||||
D_SENSOR_COUNTER "n|"
|
||||
D_SENSOR_PWM "|"
|
||||
D_SENSOR_PWM "i|"
|
||||
D_SENSOR_BUZZER "|"
|
||||
D_SENSOR_BUZZER "i|"
|
||||
D_SENSOR_LED_LINK "|" D_SENSOR_LED_LINK "i|"
|
||||
D_SENSOR_I2C_SCL "|" D_SENSOR_I2C_SDA "|"
|
||||
D_SENSOR_SPI_MISO "|" D_SENSOR_SPI_MOSI "|" D_SENSOR_SPI_CLK "|" D_SENSOR_SPI_CS "|" D_SENSOR_SPI_DC "|"
|
||||
D_SENSOR_SSPI_MISO "|" D_SENSOR_SSPI_MOSI "|" D_SENSOR_SSPI_SCLK "|" D_SENSOR_SSPI_CS "|" D_SENSOR_SSPI_DC "|"
|
||||
D_SENSOR_BACKLIGHT "|" D_SENSOR_OLED_RESET "|"
|
||||
D_SENSOR_IRSEND "|" D_SENSOR_IRRECV "|"
|
||||
D_SENSOR_RFSEND "|" D_SENSOR_RFRECV "|"
|
||||
D_SENSOR_DHT11 "|" D_SENSOR_AM2301 "|" D_SENSOR_SI7021 "|" D_SENSOR_DHT11 "o|"
|
||||
D_SENSOR_DS18X20 "|" D_SENSOR_DS18X20 "o|"
|
||||
D_SENSOR_WS2812 "|"
|
||||
D_SENSOR_MHZ_TX "|" D_SENSOR_MHZ_RX "|"
|
||||
D_SENSOR_PZEM0XX_TX "|" D_SENSOR_PZEM004_RX "|" D_SENSOR_PZEM016_RX "|" D_SENSOR_PZEM017_RX "|"
|
||||
D_SENSOR_SAIR_TX "|" D_SENSOR_SAIR_RX "|"
|
||||
D_SENSOR_PMS5003_TX "|" D_SENSOR_PMS5003_RX "|"
|
||||
D_SENSOR_SDS0X1_TX "|" D_SENSOR_SDS0X1_RX "|"
|
||||
D_SENSOR_SBR_TX "|" D_SENSOR_SBR_RX "|"
|
||||
D_SENSOR_SR04_TRIG "|" D_SENSOR_SR04_ECHO "|"
|
||||
D_SENSOR_SDM120_TX "|" D_SENSOR_SDM120_RX "|"
|
||||
D_SENSOR_SDM630_TX "|" D_SENSOR_SDM630_RX "|"
|
||||
D_SENSOR_TM1638_CLK "|" D_SENSOR_TM1638_DIO "|" D_SENSOR_TM1638_STB "|"
|
||||
D_SENSOR_DFR562 "|"
|
||||
D_SENSOR_HX711_SCK "|" D_SENSOR_HX711_DAT "|"
|
||||
D_SENSOR_TX2X_TX "|"
|
||||
D_SENSOR_TUYA_TX "|" D_SENSOR_TUYA_RX "|"
|
||||
D_SENSOR_MGC3130_XFER "|" D_SENSOR_MGC3130_RESET "|"
|
||||
D_SENSOR_RF_SENSOR "|"
|
||||
D_SENSOR_AZ_TX "|" D_SENSOR_AZ_RX "|"
|
||||
D_SENSOR_MAX31855_CS "|" D_SENSOR_MAX31855_CLK "|" D_SENSOR_MAX31855_DO "|"
|
||||
D_SENSOR_NRG_SEL "|" D_SENSOR_NRG_SEL "i|" D_SENSOR_NRG_CF1 "|" D_SENSOR_HLW_CF "|" D_SENSOR_HJL_CF "|"
|
||||
D_SENSOR_MCP39F5_TX "|" D_SENSOR_MCP39F5_RX "|" D_SENSOR_MCP39F5_RST "|"
|
||||
D_SENSOR_PN532_TX "|" D_SENSOR_PN532_RX "|"
|
||||
D_SENSOR_SM16716_CLK "|" D_SENSOR_SM16716_DAT "|" D_SENSOR_SM16716_POWER "|"
|
||||
D_SENSOR_MY92X1_DI "|" D_SENSOR_MY92X1_DCKI "|"
|
||||
D_SENSOR_CSE7766_TX "|" D_SENSOR_CSE7766_RX "|"
|
||||
D_SENSOR_ARIRFRCV "|"
|
||||
D_SENSOR_TXD "|" D_SENSOR_RXD "|"
|
||||
D_SENSOR_ROTARY "1a|" D_SENSOR_ROTARY "1b|" D_SENSOR_ROTARY "2a|" D_SENSOR_ROTARY "2b|"
|
||||
D_SENSOR_HRE_CLOCK "|" D_SENSOR_HRE_DATA "|"
|
||||
D_SENSOR_ADE7953_IRQ "|"
|
||||
D_SENSOR_ARIRFSEL "|"
|
||||
D_SENSOR_SOLAXX1_TX "|" D_SENSOR_SOLAXX1_RX "|"
|
||||
D_SENSOR_ZIGBEE_TXD "|" D_SENSOR_ZIGBEE_RXD "|"
|
||||
D_SENSOR_RDM6300_RX "|"
|
||||
D_SENSOR_IBEACON_TX "|" D_SENSOR_IBEACON_RX "|"
|
||||
D_SENSOR_A4988_DIR "|" D_SENSOR_A4988_STP "|" D_SENSOR_A4988_ENA "|" D_SENSOR_A4988_MS1 "|" D_SENSOR_A4988_MS2 "|" D_SENSOR_A4988_MS3 "|"
|
||||
D_SENSOR_DDS2382_TX "|" D_SENSOR_DDS2382_RX "|"
|
||||
D_SENSOR_DDSU666_TX "|" D_SENSOR_DDSU666_RX "|"
|
||||
D_SENSOR_SM2135_CLK "|" D_SENSOR_SM2135_DAT "|"
|
||||
D_SENSOR_DEEPSLEEP "|" D_SENSOR_EXS_ENABLE "|"
|
||||
D_SENSOR_SLAVE_TX "|" D_SENSOR_SLAVE_RX "|" D_SENSOR_SLAVE_RESET "|" D_SENSOR_SLAVE_RESET "i|"
|
||||
D_SENSOR_HPMA_RX "|" D_SENSOR_HPMA_TX "|"
|
||||
D_SENSOR_GPS_RX "|" D_SENSOR_GPS_TX "|"
|
||||
D_SENSOR_HM10_RX "|" D_SENSOR_HM10_TX "|"
|
||||
D_SENSOR_LE01MR_RX "|" D_SENSOR_LE01MR_TX "|"
|
||||
D_SENSOR_CC1101_GDO0 "|" D_SENSOR_CC1101_GDO2 "|"
|
||||
D_SENSOR_HRXL_RX "|"
|
||||
D_SENSOR_ELECTRIQ_MOODL "|"
|
||||
D_SENSOR_AS3935 "|"
|
||||
D_ANALOG_INPUT "|"
|
||||
D_TEMPERATURE "|" D_LIGHT "|"
|
||||
D_SENSOR_BUTTON "|" D_SENSOR_BUTTON "i|"
|
||||
D_RANGE "|"
|
||||
D_CT_POWER "|"
|
||||
;
|
||||
|
||||
const char kSensorNamesFixed[] PROGMEM =
|
||||
D_SENSOR_USER;
|
||||
|
||||
const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
GPIO_NONE, // Not used
|
||||
AGPIO(GPIO_KEY1) + MAX_KEYS, // Buttons
|
||||
AGPIO(GPIO_KEY1_NP) + MAX_KEYS,
|
||||
AGPIO(GPIO_KEY1_INV) + MAX_KEYS,
|
||||
AGPIO(GPIO_KEY1_INV_NP) + MAX_KEYS,
|
||||
AGPIO(GPIO_SWT1) + MAX_SWITCHES, // User connected external switches
|
||||
AGPIO(GPIO_SWT1_NP) + MAX_SWITCHES,
|
||||
AGPIO(GPIO_REL1) + MAX_RELAYS, // Relays
|
||||
AGPIO(GPIO_REL1_INV) + MAX_RELAYS,
|
||||
AGPIO(GPIO_LED1) + MAX_LEDS, // Leds
|
||||
AGPIO(GPIO_LED1_INV) + MAX_LEDS,
|
||||
#ifdef USE_COUNTER
|
||||
AGPIO(GPIO_CNTR1) + MAX_COUNTERS, // Counters
|
||||
AGPIO(GPIO_CNTR1_NP) + MAX_COUNTERS,
|
||||
#endif
|
||||
AGPIO(GPIO_PWM1) + MAX_PWMS, // RGB Red or C Cold White
|
||||
AGPIO(GPIO_PWM1_INV) + MAX_PWMS,
|
||||
#ifdef USE_BUZZER
|
||||
AGPIO(GPIO_BUZZER), // Buzzer
|
||||
AGPIO(GPIO_BUZZER_INV), // Inverted buzzer
|
||||
#endif
|
||||
AGPIO(GPIO_LEDLNK), // Link led
|
||||
AGPIO(GPIO_LEDLNK_INV), // Inverted link led
|
||||
#ifdef USE_I2C
|
||||
AGPIO(GPIO_I2C_SCL), // I2C SCL
|
||||
AGPIO(GPIO_I2C_SDA), // I2C SDA
|
||||
#endif
|
||||
#ifdef USE_SPI
|
||||
AGPIO(GPIO_SPI_MISO), // SPI MISO
|
||||
AGPIO(GPIO_SPI_MOSI), // SPI MOSI
|
||||
AGPIO(GPIO_SPI_CLK), // SPI Clk
|
||||
AGPIO(GPIO_SPI_CS), // SPI Chip Select
|
||||
AGPIO(GPIO_SPI_DC), // SPI Data Direction
|
||||
AGPIO(GPIO_SSPI_MISO), // Software SPI Master Input Slave Output
|
||||
AGPIO(GPIO_SSPI_MOSI), // Software SPI Master Output Slave Input
|
||||
AGPIO(GPIO_SSPI_SCLK), // Software SPI Serial Clock
|
||||
AGPIO(GPIO_SSPI_CS), // Software SPI Chip Select
|
||||
AGPIO(GPIO_SSPI_DC), // Software SPI Data or Command
|
||||
#endif
|
||||
#ifdef USE_DISPLAY
|
||||
AGPIO(GPIO_BACKLIGHT), // Display backlight control
|
||||
AGPIO(GPIO_OLED_RESET), // OLED Display Reset
|
||||
#endif
|
||||
|
||||
AGPIO(GPIO_TXD), // Serial interface
|
||||
AGPIO(GPIO_RXD), // Serial interface
|
||||
|
||||
#ifdef USE_DHT
|
||||
AGPIO(GPIO_DHT11), // DHT11
|
||||
AGPIO(GPIO_DHT22), // DHT21, DHT22, AM2301, AM2302, AM2321
|
||||
AGPIO(GPIO_SI7021), // iTead SI7021
|
||||
AGPIO(GPIO_DHT11_OUT), // Pseudo Single wire DHT11, DHT21, DHT22, AM2301, AM2302, AM2321
|
||||
#endif
|
||||
#ifdef USE_DS18x20
|
||||
AGPIO(GPIO_DSB), // Single wire DS18B20 or DS18S20
|
||||
AGPIO(GPIO_DSB_OUT), // Pseudo Single wire DS18B20 or DS18S20
|
||||
#endif
|
||||
|
||||
// Light
|
||||
#ifdef USE_LIGHT
|
||||
#ifdef USE_WS2812
|
||||
AGPIO(GPIO_WS2812), // WS2812 Led string
|
||||
#endif
|
||||
#ifdef USE_ARILUX_RF
|
||||
AGPIO(GPIO_ARIRFRCV), // AriLux RF Receive input
|
||||
AGPIO(GPIO_ARIRFSEL), // Arilux RF Receive input selected
|
||||
#endif
|
||||
#ifdef USE_MY92X1
|
||||
AGPIO(GPIO_DI), // my92x1 PWM input
|
||||
AGPIO(GPIO_DCKI), // my92x1 CLK input
|
||||
#endif // USE_MY92X1
|
||||
#ifdef USE_SM16716
|
||||
AGPIO(GPIO_SM16716_CLK), // SM16716 CLOCK
|
||||
AGPIO(GPIO_SM16716_DAT), // SM16716 DATA
|
||||
AGPIO(GPIO_SM16716_SEL), // SM16716 SELECT
|
||||
#endif // USE_SM16716
|
||||
#ifdef USE_SM2135
|
||||
AGPIO(GPIO_SM2135_CLK), // SM2135 CLOCK
|
||||
AGPIO(GPIO_SM2135_DAT), // SM2135 DATA
|
||||
#endif // USE_SM2135
|
||||
#ifdef USE_TUYA_MCU
|
||||
AGPIO(GPIO_TUYA_TX), // Tuya Serial interface
|
||||
AGPIO(GPIO_TUYA_RX), // Tuya Serial interface
|
||||
#endif
|
||||
#ifdef USE_EXS_DIMMER
|
||||
AGPIO(GPIO_EXS_ENABLE), // EXS MCU Enable
|
||||
#endif
|
||||
#ifdef USE_ELECTRIQ_MOODL
|
||||
AGPIO(GPIO_ELECTRIQ_MOODL_TX),
|
||||
#endif
|
||||
#endif // USE_LIGHT
|
||||
|
||||
#if defined(USE_IR_REMOTE) || defined(USE_IR_REMOTE_FULL)
|
||||
AGPIO(GPIO_IRSEND), // IR remote
|
||||
#if defined(USE_IR_RECEIVE) || defined(USE_IR_REMOTE_FULL)
|
||||
AGPIO(GPIO_IRRECV), // IR receiver
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_RC_SWITCH
|
||||
AGPIO(GPIO_RFSEND), // RF transmitter
|
||||
AGPIO(GPIO_RFRECV), // RF receiver
|
||||
#endif
|
||||
#ifdef USE_RF_SENSOR
|
||||
AGPIO(GPIO_RF_SENSOR), // Rf receiver with sensor decoding
|
||||
#endif
|
||||
#ifdef USE_SR04
|
||||
AGPIO(GPIO_SR04_TRIG), // SR04 Tri/TXgger pin
|
||||
AGPIO(GPIO_SR04_ECHO), // SR04 Ech/RXo pin
|
||||
#endif
|
||||
#ifdef USE_TM1638
|
||||
AGPIO(GPIO_TM16CLK), // TM1638 Clock
|
||||
AGPIO(GPIO_TM16DIO), // TM1638 Data I/O
|
||||
AGPIO(GPIO_TM16STB), // TM1638 Strobe
|
||||
#endif
|
||||
#ifdef USE_HX711
|
||||
AGPIO(GPIO_HX711_SCK), // HX711 Load Cell clock
|
||||
AGPIO(GPIO_HX711_DAT), // HX711 Load Cell data
|
||||
#endif
|
||||
|
||||
// Energy sensors
|
||||
#ifdef USE_ENERGY_SENSOR
|
||||
#ifdef USE_HLW8012
|
||||
AGPIO(GPIO_NRG_SEL), // HLW8012/HLJ-01 Sel output (1 = Voltage)
|
||||
AGPIO(GPIO_NRG_SEL_INV), // HLW8012/HLJ-01 Sel output (0 = Voltage)
|
||||
AGPIO(GPIO_NRG_CF1), // HLW8012/HLJ-01 CF1 voltage / current
|
||||
AGPIO(GPIO_HLW_CF), // HLW8012 CF power
|
||||
AGPIO(GPIO_HJL_CF), // HJL-01/BL0937 CF power
|
||||
#endif
|
||||
#if defined(USE_I2C) && defined(USE_ADE7953)
|
||||
AGPIO(GPIO_ADE7953_IRQ), // ADE7953 IRQ
|
||||
#endif
|
||||
#ifdef USE_CSE7766
|
||||
AGPIO(GPIO_CSE7766_TX), // CSE7766 Serial interface (S31 and Pow R2)
|
||||
AGPIO(GPIO_CSE7766_RX), // CSE7766 Serial interface (S31 and Pow R2)
|
||||
#endif
|
||||
#ifdef USE_MCP39F501
|
||||
AGPIO(GPIO_MCP39F5_TX), // MCP39F501 Serial interface (Shelly2)
|
||||
AGPIO(GPIO_MCP39F5_RX), // MCP39F501 Serial interface (Shelly2)
|
||||
AGPIO(GPIO_MCP39F5_RST), // MCP39F501 Reset (Shelly2)
|
||||
#endif
|
||||
#if defined(USE_PZEM004T) || defined(USE_PZEM_AC) || defined(USE_PZEM_DC)
|
||||
AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface
|
||||
#endif
|
||||
#ifdef USE_PZEM004T
|
||||
AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface
|
||||
#endif
|
||||
#ifdef USE_PZEM_AC
|
||||
AGPIO(GPIO_PZEM016_RX), // PZEM-014,016 Serial Modbus interface
|
||||
#endif
|
||||
#ifdef USE_PZEM_DC
|
||||
AGPIO(GPIO_PZEM017_RX), // PZEM-003,017 Serial Modbus interface
|
||||
#endif
|
||||
#ifdef USE_SDM120
|
||||
AGPIO(GPIO_SDM120_TX), // SDM120 Serial interface
|
||||
AGPIO(GPIO_SDM120_RX), // SDM120 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SDM630
|
||||
AGPIO(GPIO_SDM630_TX), // SDM630 Serial interface
|
||||
AGPIO(GPIO_SDM630_RX), // SDM630 Serial interface
|
||||
#endif
|
||||
#ifdef USE_DDS2382
|
||||
AGPIO(GPIO_DDS2382_TX), // DDS2382 Serial interface
|
||||
AGPIO(GPIO_DDS2382_RX), // DDS2382 Serial interface
|
||||
#endif
|
||||
#ifdef USE_DDSU666
|
||||
AGPIO(GPIO_DDSU666_TX), // DDSU666 Serial interface
|
||||
AGPIO(GPIO_DDSU666_RX), // DDSU666 Serial interface
|
||||
#endif // USE_DDSU666
|
||||
#ifdef USE_SOLAX_X1
|
||||
AGPIO(GPIO_SOLAXX1_TX), // Solax Inverter tx pin
|
||||
AGPIO(GPIO_SOLAXX1_RX), // Solax Inverter rx pin
|
||||
#endif // USE_SOLAX_X1
|
||||
#ifdef USE_LE01MR
|
||||
AGPIO(GPIO_LE01MR_RX), // F7F LE-01MR energy meter rx pin
|
||||
AGPIO(GPIO_LE01MR_TX), // F7F LE-01MR energy meter tx pin
|
||||
#endif // IFDEF:USE_LE01MR
|
||||
#endif // USE_ENERGY_SENSOR
|
||||
|
||||
// Serial
|
||||
#ifdef USE_SERIAL_BRIDGE
|
||||
AGPIO(GPIO_SBR_TX), // Serial Bridge Serial interface
|
||||
AGPIO(GPIO_SBR_RX), // Serial Bridge Serial interface
|
||||
#endif
|
||||
#ifdef USE_ZIGBEE
|
||||
AGPIO(GPIO_ZIGBEE_TX), // Zigbee Serial interface
|
||||
AGPIO(GPIO_ZIGBEE_RX), // Zigbee Serial interface
|
||||
#endif
|
||||
#ifdef USE_MHZ19
|
||||
AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface
|
||||
AGPIO(GPIO_MHZ_RXD), // MH-Z19 Serial interface
|
||||
#endif
|
||||
#ifdef USE_SENSEAIR
|
||||
AGPIO(GPIO_SAIR_TX), // SenseAir Serial interface
|
||||
AGPIO(GPIO_SAIR_RX), // SenseAir Serial interface
|
||||
#endif
|
||||
#ifdef USE_NOVA_SDS
|
||||
AGPIO(GPIO_SDS0X1_TX), // Nova Fitness SDS011 Serial interface
|
||||
AGPIO(GPIO_SDS0X1_RX), // Nova Fitness SDS011 Serial interface
|
||||
#endif
|
||||
#ifdef USE_HPMA
|
||||
AGPIO(GPIO_HPMA_TX), // Honeywell HPMA115S0 Serial interface
|
||||
AGPIO(GPIO_HPMA_RX), // Honeywell HPMA115S0 Serial interface
|
||||
#endif
|
||||
#ifdef USE_PMS5003
|
||||
AGPIO(GPIO_PMS5003_TX), // Plantower PMS5003 Serial interface
|
||||
AGPIO(GPIO_PMS5003_RX), // Plantower PMS5003 Serial interface
|
||||
#endif
|
||||
#if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR)
|
||||
AGPIO(GPIO_TX2X_TXD_BLACK), // TX20/TX23 Transmission Pin
|
||||
#endif
|
||||
#ifdef USE_MP3_PLAYER
|
||||
AGPIO(GPIO_MP3_DFR562), // RB-DFR-562, DFPlayer Mini MP3 Player Serial interface
|
||||
#endif
|
||||
#ifdef USE_AZ7798
|
||||
AGPIO(GPIO_AZ_TXD), // AZ-Instrument 7798 CO2 datalogger Serial interface
|
||||
AGPIO(GPIO_AZ_RXD), // AZ-Instrument 7798 CO2 datalogger Serial interface
|
||||
#endif
|
||||
#ifdef USE_PN532_HSU
|
||||
AGPIO(GPIO_PN532_TXD), // PN532 HSU Tx
|
||||
AGPIO(GPIO_PN532_RXD), // PN532 HSU Rx
|
||||
#endif
|
||||
#ifdef USE_TASMOTA_SLAVE
|
||||
AGPIO(GPIO_TASMOTASLAVE_TXD), // Tasmota Slave TX
|
||||
AGPIO(GPIO_TASMOTASLAVE_RXD), // Tasmota Slave RX
|
||||
AGPIO(GPIO_TASMOTASLAVE_RST), // Tasmota Slave Reset
|
||||
AGPIO(GPIO_TASMOTASLAVE_RST_INV), // Tasmota Slave Reset Inverted
|
||||
#endif
|
||||
#ifdef USE_RDM6300
|
||||
AGPIO(GPIO_RDM6300_RX),
|
||||
#endif
|
||||
#ifdef USE_IBEACON
|
||||
AGPIO(GPIO_IBEACON_RX),
|
||||
AGPIO(GPIO_IBEACON_TX),
|
||||
#endif
|
||||
#ifdef USE_GPS
|
||||
AGPIO(GPIO_GPS_RX), // GPS serial interface
|
||||
AGPIO(GPIO_GPS_TX), // GPS serial interface
|
||||
#endif
|
||||
#ifdef USE_HM10
|
||||
AGPIO(GPIO_HM10_RX), // GPS serial interface
|
||||
AGPIO(GPIO_HM10_TX), // GPS serial interface
|
||||
#endif
|
||||
|
||||
#ifdef USE_MGC3130
|
||||
AGPIO(GPIO_MGC3130_XFER),
|
||||
AGPIO(GPIO_MGC3130_RESET),
|
||||
#endif
|
||||
#ifdef USE_MAX31855
|
||||
AGPIO(GPIO_MAX31855CS), // MAX31855 Serial interface
|
||||
AGPIO(GPIO_MAX31855CLK), // MAX31855 Serial interface
|
||||
AGPIO(GPIO_MAX31855DO), // MAX31855 Serial interface
|
||||
#endif
|
||||
#ifdef ROTARY_V1
|
||||
AGPIO(GPIO_ROT1A), // Rotary switch1 A Pin
|
||||
AGPIO(GPIO_ROT1B), // Rotary switch1 B Pin
|
||||
AGPIO(GPIO_ROT2A), // Rotary switch2 A Pin
|
||||
AGPIO(GPIO_ROT2B), // Rotary switch2 B Pin
|
||||
#endif
|
||||
#ifdef USE_HRE
|
||||
AGPIO(GPIO_HRE_CLOCK),
|
||||
AGPIO(GPIO_HRE_DATA),
|
||||
#endif
|
||||
#ifdef USE_A4988_STEPPER
|
||||
AGPIO(GPIO_A4988_DIR), // A4988 direction pin
|
||||
AGPIO(GPIO_A4988_STP), // A4988 step pin
|
||||
// folowing are not mandatory
|
||||
AGPIO(GPIO_A4988_ENA), // A4988 enabled pin
|
||||
AGPIO(GPIO_A4988_MS1), // A4988 microstep pin1
|
||||
AGPIO(GPIO_A4988_MS2), // A4988 microstep pin2
|
||||
AGPIO(GPIO_A4988_MS3), // A4988 microstep pin3
|
||||
#endif
|
||||
#ifdef USE_DEEPSLEEP
|
||||
AGPIO(GPIO_DEEPSLEEP),
|
||||
#endif
|
||||
#ifdef USE_KEELOQ
|
||||
AGPIO(GPIO_CC1101_GDO0), // CC1101 pin for RX
|
||||
AGPIO(GPIO_CC1101_GDO2), // CC1101 pin for RX
|
||||
#endif
|
||||
#ifdef USE_HRXL
|
||||
AGPIO(GPIO_HRXL_RX),
|
||||
#endif
|
||||
#ifdef USE_AS3935
|
||||
AGPIO(GPIO_AS3935),
|
||||
#endif
|
||||
/*
|
||||
#ifndef USE_ADC_VCC
|
||||
AGPIO(ADC0_INPUT), // Analog input
|
||||
AGPIO(ADC0_TEMP), // Thermistor
|
||||
AGPIO(ADC0_LIGHT), // Light sensor
|
||||
AGPIO(ADC0_BUTTON), // Button
|
||||
AGPIO(ADC0_BUTTON_INV),
|
||||
AGPIO(ADC0_RANGE), // Range
|
||||
AGPIO(ADC0_CT_POWER), // Current
|
||||
#endif
|
||||
*/
|
||||
};
|
||||
|
||||
//********************************************************************************************
|
||||
|
||||
#define MAX_GPIO_PIN 40 // Number of supported GPIO
|
||||
#define MIN_FLASH_PINS 4 // Number of flash chip pins unusable for configuration (GPIO6, 7, 8 and 11)
|
||||
#define MAX_USER_PINS 36 // MAX_GPIO_PIN - MIN_FLASH_PINS
|
||||
#define WEMOS_MODULE 0 // Wemos module
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233343536373839
|
||||
const char PINS_WEMOS[] PROGMEM = "IOTXIORXIOIOflashcFLFLolIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOA6A7A0IoIoA3";
|
||||
|
||||
//********************************************************************************************
|
||||
|
||||
typedef struct MYIO {
|
||||
uint16_t io[MAX_GPIO_PIN];
|
||||
} myio; // 40 * 2 = 80 bytes
|
||||
|
||||
typedef struct MYCFGIO {
|
||||
uint16_t io[MAX_USER_PINS];
|
||||
} mycfgio; // 36 * 2 = 72 bytes
|
||||
|
||||
#define GPIO_FLAG_USED 0 // Currently no flags used
|
||||
|
||||
typedef union {
|
||||
uint16_t data;
|
||||
struct {
|
||||
uint16_t spare00 : 1;
|
||||
uint16_t spare01 : 1;
|
||||
uint16_t spare02 : 1;
|
||||
uint16_t spare03 : 1;
|
||||
uint16_t spare04 : 1;
|
||||
uint16_t spare05 : 1;
|
||||
uint16_t spare06 : 1;
|
||||
uint16_t spare07 : 1;
|
||||
uint16_t spare08 : 1;
|
||||
uint16_t spare09 : 1;
|
||||
uint16_t spare10 : 1;
|
||||
uint16_t spare11 : 1;
|
||||
uint16_t spare12 : 1;
|
||||
uint16_t spare13 : 1;
|
||||
uint16_t spare14 : 1;
|
||||
uint16_t spare15 : 1;
|
||||
};
|
||||
} gpio_flag; // 2 bytes
|
||||
|
||||
typedef struct MYTMPLT {
|
||||
mycfgio gp; // 72 bytes
|
||||
gpio_flag flag; // 2 bytes
|
||||
} mytmplt; // 74 bytes
|
||||
|
||||
/********************************************************************************************/
|
||||
// Supported hardware modules
|
||||
enum SupportedModules {
|
||||
WEMOS, ESP32_CAM_AITHINKER,
|
||||
MAXMODULE};
|
||||
|
||||
#define USER_MODULE 255
|
||||
|
||||
const char kModuleNames[] PROGMEM =
|
||||
"ESP32-DevKit|ESP32 Cam AiThinker";
|
||||
|
||||
// Default module settings
|
||||
const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
|
||||
WEMOS,
|
||||
ESP32_CAM_AITHINKER
|
||||
};
|
||||
|
||||
const mytmplt kModules PROGMEM =
|
||||
{ // WEMOS - Espressif ESP32-DevKitC - Any ESP32 device like WeMos and NodeMCU hardware (ESP32)
|
||||
AGPIO(GPIO_USER), // 0 (I)O GPIO0, ADC2_CH1, TOUCH1, RTC_GPIO11, CLK_OUT1, EMAC_TX_CLK
|
||||
AGPIO(GPIO_USER), // 1 IO TXD0 GPIO1, U0TXD, CLK_OUT3, EMAC_RXD2
|
||||
AGPIO(GPIO_USER), // 2 IO GPIO2, ADC2_CH2, TOUCH2, RTC_GPIO12, HSPIWP, HS2_DATA0, SD_DATA0
|
||||
AGPIO(GPIO_USER), // 3 IO RXD0 GPIO3, U0RXD, CLK_OUT2
|
||||
AGPIO(GPIO_USER), // 4 IO GPIO4, ADC2_CH0, TOUCH0, RTC_GPIO10, HSPIHD, HS2_DATA1, SD_DATA1, EMAC_TX_ER
|
||||
AGPIO(GPIO_USER), // 5 IO GPIO5, VSPICS0, HS1_DATA6, EMAC_RX_CLK
|
||||
// 6 IO GPIO6, Flash CLK
|
||||
// 7 IO GPIO7, Flash D0
|
||||
// 8 IO GPIO8, Flash D1
|
||||
AGPIO(GPIO_USER), // 9 IO GPIO9, Flash D2, U1RXD
|
||||
AGPIO(GPIO_USER), // 10 IO GPIO10, Flash D3, U1TXD
|
||||
// 11 IO GPIO11, Flash CMD
|
||||
AGPIO(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.)
|
||||
AGPIO(GPIO_USER), // 13 IO GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER
|
||||
AGPIO(GPIO_USER), // 14 IO GPIO14, ADC2_CH6, TOUCH6, RTC_GPIO16, MTMS, HSPICLK, HS2_CLK, SD_CLK, EMAC_TXD2
|
||||
AGPIO(GPIO_USER), // 15 (I)O GPIO15, ADC2_CH3, TOUCH3, MTDO, HSPICS0, RTC_GPIO13, HS2_CMD, SD_CMD, EMAC_RXD3 (If driven Low, silences boot messages from normal boot. Has internal pull-up, so unconnected = High = normal output.)
|
||||
AGPIO(GPIO_USER), // 16 IO GPIO16, HS1_DATA4, U2RXD, EMAC_CLK_OUT
|
||||
AGPIO(GPIO_USER), // 17 IO GPIO17, HS1_DATA5, U2TXD, EMAC_CLK_OUT_180
|
||||
AGPIO(GPIO_USER), // 18 IO GPIO18, VSPICLK, HS1_DATA7
|
||||
AGPIO(GPIO_USER), // 19 IO GPIO19, VSPIQ, U0CTS, EMAC_TXD0
|
||||
0, // 20
|
||||
AGPIO(GPIO_USER), // 21 IO GPIO21, VSPIHD, EMAC_TX_EN
|
||||
AGPIO(GPIO_USER), // 22 IO LED GPIO22, VSPIWP, U0RTS, EMAC_TXD1
|
||||
AGPIO(GPIO_USER), // 23 IO GPIO23, VSPID, HS1_STROBE
|
||||
0, // 24
|
||||
AGPIO(GPIO_USER), // 25 IO GPIO25, DAC_1, ADC2_CH8, RTC_GPIO6, EMAC_RXD0
|
||||
AGPIO(GPIO_USER), // 26 IO GPIO26, DAC_2, ADC2_CH9, RTC_GPIO7, EMAC_RXD1
|
||||
AGPIO(GPIO_USER), // 27 IO GPIO27, ADC2_CH7, TOUCH7, RTC_GPIO17, EMAC_RX_DV
|
||||
0, // 28
|
||||
0, // 29
|
||||
0, // 30
|
||||
0, // 31
|
||||
AGPIO(GPIO_USER), // 32 IO GPIO32, XTAL_32K_P (32.768 kHz crystal oscillator input), ADC1_CH4, TOUCH9, RTC_GPIO9
|
||||
AGPIO(GPIO_USER), // 33 IO GPIO33, XTAL_32K_N (32.768 kHz crystal oscillator output), ADC1_CH5, TOUCH8, RTC_GPIO8
|
||||
AGPIO(GPIO_USER), // 34 I NO PULLUP GPIO34, ADC1_CH6, RTC_GPIO4
|
||||
AGPIO(GPIO_USER), // 35 I NO PULLUP GPIO35, ADC1_CH7, RTC_GPIO5
|
||||
AGPIO(GPIO_USER), // 36 I NO PULLUP GPIO36, SENSOR_VP, ADC_H, ADC1_CH0, RTC_GPIO0
|
||||
0, // 37 NO PULLUP
|
||||
0, // 38 NO PULLUP
|
||||
AGPIO(GPIO_USER), // 39 I NO PULLUP GPIO39, SENSOR_VN, ADC1_CH3, ADC_H, RTC_GPIO3
|
||||
0 // Flag
|
||||
};
|
||||
|
||||
#endif // ESP32
|
||||
|
||||
#endif // _TASMOTA_TEMPLATE_ESP32_FINAL_H_
|
@ -20,7 +20,7 @@
|
||||
#ifndef _TASMOTA_VERSION_H_
|
||||
#define _TASMOTA_VERSION_H_
|
||||
|
||||
const uint32_t VERSION = 0x08020005;
|
||||
const uint32_t VERSION = 0x08020006;
|
||||
|
||||
// Lowest compatible version
|
||||
const uint32_t VERSION_COMPATIBLE = 0x07010006;
|
||||
|
@ -239,14 +239,6 @@ const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM =
|
||||
"eb('g'+g).value=s;"
|
||||
"}";
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
"var os;"
|
||||
"function sk(s,g){" // s = value, g = id and name
|
||||
"var o=os.replace(/}2/g,\"<option value='\").replace(/}3/g,\")</option>\");"
|
||||
"eb('g'+g).innerHTML=o;"
|
||||
"eb('g'+g).value=s;"
|
||||
"}";
|
||||
#else // FINAL_ESP32
|
||||
"var os,hs;"
|
||||
"function ce(i,q){" // Create index select
|
||||
"var o=document.createElement('option');"
|
||||
@ -268,7 +260,6 @@ const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM =
|
||||
"eb('g'+g).value=(g<99)?s&0xffe0:s;"
|
||||
"if(g<99){ot(g,s);}"
|
||||
"}";
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
|
||||
const char HTTP_SCRIPT_TEMPLATE[] PROGMEM =
|
||||
@ -1468,20 +1459,14 @@ void HandleTemplateConfiguration(void)
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
uint32_t midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // FINAL_ESP32
|
||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||
uint32_t midx = ridx >> 5;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), ridx);
|
||||
}
|
||||
WSContentSend_P(PSTR("\";"));
|
||||
|
||||
#ifdef ESP32
|
||||
#ifdef FINAL_ESP32
|
||||
WSContentSend_P(PSTR("hs=["));
|
||||
bool first_done = false;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(kGpioNiceList); i++) {
|
||||
@ -1491,7 +1476,6 @@ void HandleTemplateConfiguration(void)
|
||||
first_done = true;
|
||||
}
|
||||
WSContentSend_P(PSTR("];"));
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP32
|
||||
|
||||
WSContentSend_P(HTTP_SCRIPT_TEMPLATE2);
|
||||
@ -1528,14 +1512,9 @@ void HandleTemplateConfiguration(void)
|
||||
WSContentSend_P(PSTR("<tr><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d'></select></td></tr>"),
|
||||
((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? " style='width:200px'" : "", i);
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
WSContentSend_P(PSTR("<tr><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d'></select></td></tr>"),
|
||||
((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? " style='width:200px'" : "", i);
|
||||
#else // FINAL_ESP32
|
||||
WSContentSend_P(PSTR("<tr><td><b><font color='#%06x'>" D_GPIO "%d</font></b></td><td%s><select id='g%d' onchange='ot(%d,this.value)'></select></td>"),
|
||||
((9==i)||(10==i)) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? " style='width:150px'" : "", i, i);
|
||||
WSContentSend_P(PSTR("<td style='width:50px'><select id='h%d'></select></td></tr>"), i);
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266
|
||||
}
|
||||
}
|
||||
@ -1575,14 +1554,12 @@ void TemplateSaveSettings(void)
|
||||
WebGetArg(webindex, tmp, sizeof(tmp)); // GPIO
|
||||
uint32_t gpio = atoi(tmp);
|
||||
#ifdef ESP32
|
||||
#ifdef FINAL_ESP32
|
||||
char tmp2[8]; // WebGetArg numbers only
|
||||
char webindex2[5]; // WebGetArg name
|
||||
snprintf_P(webindex2, sizeof(webindex2), PSTR("h%d"), j);
|
||||
WebGetArg(webindex2, tmp2, sizeof(tmp2));
|
||||
uint32_t value2 = (!strlen(tmp2)) ? 0 : atoi(tmp2) -1;
|
||||
gpio += value2;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP32
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s%d"), svalue, (i>0)?",":"", gpio);
|
||||
j++;
|
||||
@ -1646,13 +1623,8 @@ void HandleModuleConfiguration(void)
|
||||
midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
midx = pgm_read_byte(kGpioNiceList + i);
|
||||
uint32_t ridx = midx;
|
||||
#else // FINAL_ESP32
|
||||
uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0;
|
||||
midx = ridx >> 5;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
if (!GetUsedInModule(midx, cmodule.io)) {
|
||||
WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), ridx);
|
||||
@ -1661,7 +1633,6 @@ void HandleModuleConfiguration(void)
|
||||
WSContentSend_P(PSTR("\";"));
|
||||
|
||||
#ifdef ESP32
|
||||
#ifdef FINAL_ESP32
|
||||
WSContentSend_P(PSTR("hs=["));
|
||||
bool first_done = false;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(kGpioNiceList); i++) {
|
||||
@ -1671,7 +1642,6 @@ void HandleModuleConfiguration(void)
|
||||
first_done = true;
|
||||
}
|
||||
WSContentSend_P(PSTR("];"));
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP32
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmodule.io); i++) {
|
||||
@ -1703,14 +1673,9 @@ void HandleModuleConfiguration(void)
|
||||
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);
|
||||
#else // ESP32
|
||||
#ifndef FINAL_ESP32
|
||||
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);
|
||||
#else // FINAL_ESP32
|
||||
WSContentSend_P(PSTR("<tr><td style='width:116px'>%s <b>" D_GPIO "%d</b></td><td style='width:150px'><select id='g%d' onchange='ot(%d,this.value)'></select></td>"),
|
||||
(WEMOS==my_module_type)?stemp:"", i, i, i);
|
||||
WSContentSend_P(PSTR("<td style='width:50px'><select id='h%d'></select></td></tr>"), i);
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266
|
||||
}
|
||||
}
|
||||
@ -1749,14 +1714,12 @@ void ModuleSaveSettings(void)
|
||||
WebGetArg(webindex, tmp, sizeof(tmp));
|
||||
uint32_t value = (!strlen(tmp)) ? 0 : atoi(tmp);
|
||||
#ifdef ESP32
|
||||
#ifdef FINAL_ESP32
|
||||
char tmp2[8]; // WebGetArg numbers only
|
||||
char webindex2[5]; // WebGetArg name
|
||||
snprintf_P(webindex2, sizeof(webindex2), PSTR("h%d"), i);
|
||||
WebGetArg(webindex2, tmp2, sizeof(tmp2));
|
||||
uint32_t value2 = (!strlen(tmp2)) ? 0 : atoi(tmp2) -1;
|
||||
value += value2;
|
||||
#endif // FINAL_ESP32
|
||||
#endif // ESP8266 - ESP32
|
||||
Settings.my_gp.io[i] = value;
|
||||
gpios += F(", " D_GPIO ); gpios += String(i); gpios += F(" "); gpios += String(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user