diff --git a/CHANGELOG.md b/CHANGELOG.md index 50a0f8fef..5cef53e8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. ### Fixed - ESP32 upgrade by file upload response based on file size (#22500) +- Wrong GUI Module and Template drop down list indexes regression ### Removed diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 81ce401f6..fccfc5b66 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -107,7 +107,7 @@ const uint8_t MAX_I2S = 2; // Max number of Hardware I2S contro const uint8_t MAX_RMT = 0; // Max number or RMT channels (0 if unknown) #endif #else -const uint8_t MAX_SPI = 0; // Max number of Hardware SPI controllers (ESP8266 = 0, no choice) +const uint8_t MAX_SPI = 1; // Max number of Hardware SPI controllers const uint8_t MAX_I2S = 0; // Max number of Hardware I2S controllers (ESP8266 = 0, no choice) const uint8_t MAX_RMT = 0; // No RMT channel on ESP8266 #endif diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 7e6ba23b3..7c02d9f7f 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -543,6 +543,7 @@ const char kWebColors[] PROGMEM = #define AGPIO(x) ((x)<<5) #define BGPIO(x) ((x)>>5) +#define AGMAX(x) ((x)?(x-1):0) #ifdef USE_DEVICE_GROUPS #define SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, ...) _SendDeviceGroupMessage(DEVICE_INDEX, REQUEST_TYPE, __VA_ARGS__, 0) diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index f570f8894..0a0ce7e71 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -509,90 +509,90 @@ const char kSensorNamesFixed[] PROGMEM = D_SENSOR_USER; // Max number of GPIOs -#define MAX_I2C 1 // Display no index if one bus +#define MAX_I2C 1 // Display no index if one bus #ifdef USE_I2C_BUS2 #undef MAX_I2C -#define MAX_I2C 2 +#define MAX_I2C 2 #endif -#define MAX_MAX31855S 6 -#define MAX_MAX31865S 6 -#define MAX_MCP23XXX 6 -#define MAX_FLOWRATEMETER 2 -#define MAX_A4988_MSS 3 -#define MAX_WEBCAM_DATA 8 -#define MAX_WEBCAM_HSD 3 -#define MAX_SM2135_DAT 10 -#define MAX_SM2335_DAT 16 -#define MAX_DSB 4 -#define MAX_BP1658CJ_DAT 16 -#define MAX_DINGTIAN_SHIFT 4 +#define MAX_MAX31855S 6 +#define MAX_MAX31865S 6 +#define MAX_MCP23XXX 6 +#define MAX_FLOWRATEMETER 2 +#define MAX_A4988_MSS 3 +#define MAX_WEBCAM_DATA 8 +#define MAX_WEBCAM_HSD 3 +#define MAX_SM2135_DAT 10 +#define MAX_SM2335_DAT 16 +#define MAX_DSB 4 +#define MAX_BP1658CJ_DAT 16 +#define MAX_DINGTIAN_SHIFT 4 #define MAX_MAGIC_SWITCH_MODES 2 -#define MAX_BL0906_RX 6 // Model number of phases, 2 (EM2), 6 (EM6) -#define MAX_BL0942_RX 8 // Baudrates 1/5 (4800), 2/6 (9600), 3/7 (19200), 4/8 (38400), Support Positive values only 1..4, Support also negative values 5..8 -#define MAX_CSE7761 2 // Model 1/2 (DUALR3), 2/2 (POWCT) +#define MAX_BL0906_RX 6 // Model number of phases, 2 (EM2), 6 (EM6) +#define MAX_BL0942_RX 8 // Baudrates 1/5 (4800), 2/6 (9600), 3/7 (19200), 4/8 (38400), Support Positive values only 1..4, Support also negative values 5..8 +#define MAX_CSE7761 2 // Model 1/2 (DUALR3), 2/2 (POWCT) const uint16_t kGpioNiceList[] PROGMEM = { - GPIO_NONE, // Not used - AGPIO(GPIO_OPTION_A) + MAX_OPTIONS_A -1, // Device specific options + GPIO_NONE, // Not used + AGPIO(GPIO_OPTION_A) + AGMAX(MAX_OPTIONS_A), // Device specific options #ifdef ESP32 - AGPIO(GPIO_OPTION_E) + MAX_OPTIONS_E -1, // Device module emulation + AGPIO(GPIO_OPTION_E) + AGMAX(MAX_OPTIONS_E), // Device module emulation #endif - AGPIO(GPIO_KEY1) + MAX_KEYS -1, // Buttons - AGPIO(GPIO_KEY1_NP) + MAX_KEYS -1, + AGPIO(GPIO_KEY1) + AGMAX(MAX_KEYS), // Buttons + AGPIO(GPIO_KEY1_NP) + AGMAX(MAX_KEYS), #ifdef ESP32 - AGPIO(GPIO_KEY1_PD) + MAX_KEYS -1, + AGPIO(GPIO_KEY1_PD) + AGMAX(MAX_KEYS), #endif - AGPIO(GPIO_KEY1_INV) + MAX_KEYS -1, - AGPIO(GPIO_KEY1_INV_NP) + MAX_KEYS -1, + AGPIO(GPIO_KEY1_INV) + AGMAX(MAX_KEYS), + AGPIO(GPIO_KEY1_INV_NP) + AGMAX(MAX_KEYS), #ifdef ESP32 - AGPIO(GPIO_KEY1_INV_PD) + MAX_KEYS -1, + AGPIO(GPIO_KEY1_INV_PD) + AGMAX(MAX_KEYS), #if defined(SOC_TOUCH_VERSION_1) || defined(SOC_TOUCH_VERSION_2) - AGPIO(GPIO_KEY1_TC) + MAX_KEYS -1, // Touch button + AGPIO(GPIO_KEY1_TC) + AGMAX(MAX_KEYS), // Touch button #endif // ESP32 SOC_TOUCH_VERSION_1 or SOC_TOUCH_VERSION_2 #endif - AGPIO(GPIO_SWT1) + MAX_SWITCHES -1, // User connected external switches - AGPIO(GPIO_SWT1_NP) + MAX_SWITCHES -1, + AGPIO(GPIO_SWT1) + AGMAX(MAX_SWITCHES), // User connected external switches + AGPIO(GPIO_SWT1_NP) + AGMAX(MAX_SWITCHES), #ifdef ESP32 - AGPIO(GPIO_SWT1_PD) + MAX_SWITCHES -1, + AGPIO(GPIO_SWT1_PD) + AGMAX(MAX_SWITCHES), #endif #ifdef ROTARY_V1 - AGPIO(GPIO_ROT1A) + MAX_ROTARIES -1, // Rotary A Pin - AGPIO(GPIO_ROT1B) + MAX_ROTARIES -1, // Rotary B Pin - AGPIO(GPIO_ROT1A_NP) + MAX_ROTARIES -1, // Rotary A Pin No Pullup - AGPIO(GPIO_ROT1B_NP) + MAX_ROTARIES -1, // Rotary B Pin No Pullup + AGPIO(GPIO_ROT1A) + AGMAX(MAX_ROTARIES), // Rotary A Pin + AGPIO(GPIO_ROT1B) + AGMAX(MAX_ROTARIES), // Rotary B Pin + AGPIO(GPIO_ROT1A_NP) + AGMAX(MAX_ROTARIES), // Rotary A Pin No Pullup + AGPIO(GPIO_ROT1B_NP) + AGMAX(MAX_ROTARIES), // Rotary B Pin No Pullup #endif - AGPIO(GPIO_REL1) + MAX_RELAYS -1, // Relays - AGPIO(GPIO_REL1_INV) + MAX_RELAYS -1, - AGPIO(GPIO_REL1_BI) + MAX_RELAYS -1, // Bistable (Latching) two coil relays - AGPIO(GPIO_REL1_BI_INV) + MAX_RELAYS -1, - AGPIO(GPIO_LED1) + MAX_LEDS -1, // Leds - AGPIO(GPIO_LED1_INV) + MAX_LEDS -1, + AGPIO(GPIO_REL1) + AGMAX(MAX_RELAYS), // Relays + AGPIO(GPIO_REL1_INV) + AGMAX(MAX_RELAYS), + AGPIO(GPIO_REL1_BI) + AGMAX(MAX_RELAYS), // Bistable (Latching) two coil relays + AGPIO(GPIO_REL1_BI_INV) + AGMAX(MAX_RELAYS), + AGPIO(GPIO_LED1) + AGMAX(MAX_LEDS), // Leds + AGPIO(GPIO_LED1_INV) + AGMAX(MAX_LEDS), #ifdef USE_COUNTER - AGPIO(GPIO_CNTR1) + MAX_COUNTERS -1, // Counters - AGPIO(GPIO_CNTR1_NP) + MAX_COUNTERS -1, + AGPIO(GPIO_CNTR1) + AGMAX(MAX_COUNTERS), // Counters + AGPIO(GPIO_CNTR1_NP) + AGMAX(MAX_COUNTERS), #endif - AGPIO(GPIO_PWM1) + MAX_PWMS -1, // RGB Red or C Cold White - AGPIO(GPIO_PWM1_INV) + MAX_PWMS -1, // or extended PWM for ESP32 + AGPIO(GPIO_PWM1) + AGMAX(MAX_PWMS), // RGB Red or C Cold White + AGPIO(GPIO_PWM1_INV) + AGMAX(MAX_PWMS), // or extended PWM for ESP32 #ifdef USE_BUZZER - AGPIO(GPIO_BUZZER), // Buzzer - AGPIO(GPIO_BUZZER_INV), // Inverted buzzer + AGPIO(GPIO_BUZZER), // Buzzer + AGPIO(GPIO_BUZZER_INV), // Inverted buzzer #endif - AGPIO(GPIO_LEDLNK), // Link led - AGPIO(GPIO_LEDLNK_INV), // Inverted link led + AGPIO(GPIO_LEDLNK), // Link led + AGPIO(GPIO_LEDLNK_INV), // Inverted link led #ifdef USE_BERRY - AGPIO(GPIO_INPUT) + MAX_SWITCHES -1, // Pure digital input to be read via Berry - AGPIO(GPIO_INTERRUPT) + MAX_SWITCHES -1, // Interrupt pins to be catched by Berry + AGPIO(GPIO_INPUT) + AGMAX(MAX_SWITCHES), // Pure digital input to be read via Berry + AGPIO(GPIO_INTERRUPT) + AGMAX(MAX_SWITCHES), // Interrupt pins to be catched by Berry #endif - AGPIO(GPIO_OUTPUT_HI), // Fixed output high - AGPIO(GPIO_OUTPUT_LO), // Fixed output low - AGPIO(GPIO_HEARTBEAT), // Every second pulsed high - AGPIO(GPIO_HEARTBEAT_INV), // Every second pulsed low - AGPIO(GPIO_RESET), // Generic reset + AGPIO(GPIO_OUTPUT_HI), // Fixed output high + AGPIO(GPIO_OUTPUT_LO), // Fixed output low + AGPIO(GPIO_HEARTBEAT), // Every second pulsed high + AGPIO(GPIO_HEARTBEAT_INV), // Every second pulsed low + AGPIO(GPIO_RESET), // Generic reset #ifdef USE_FTC532 - AGPIO(GPIO_FTC532), // FTC532 touch input + AGPIO(GPIO_FTC532), // FTC532 touch input #endif #ifdef USE_BS814A2 - AGPIO(GPIO_BS814_CLK), // Holtek BS814A2 touch ctrlr + AGPIO(GPIO_BS814_CLK), // Holtek BS814A2 touch ctrlr AGPIO(GPIO_BS814_DAT), #endif @@ -601,48 +601,48 @@ const uint16_t kGpioNiceList[] PROGMEM = { \*-------------------------------------------------------------------------------------------*/ #ifdef USE_I2C - AGPIO(GPIO_I2C_SCL) + MAX_I2C -1, // I2C SCL - AGPIO(GPIO_I2C_SDA) + MAX_I2C -1, // I2C SDA + AGPIO(GPIO_I2C_SCL) + AGMAX(MAX_I2C), // I2C SCL + AGPIO(GPIO_I2C_SDA) + AGMAX(MAX_I2C), // I2C SDA #ifdef USE_PCF8574 - AGPIO(GPIO_PCF8574_INT), // PCF8574 Interrupt + AGPIO(GPIO_PCF8574_INT), // PCF8574 Interrupt #endif // USE_PCF8574 #ifdef USE_I2C_SERIAL - AGPIO(GPIO_I2C_SER_TX) + MAX_I2C -1, // I2C via Serial TX - AGPIO(GPIO_I2C_SER_RX) + MAX_I2C -1, // I2C via Serial RX + AGPIO(GPIO_I2C_SER_TX) + AGMAX(MAX_I2C), // I2C via Serial TX + AGPIO(GPIO_I2C_SER_RX) + AGMAX(MAX_I2C), // I2C via Serial RX #endif // USE_I2C_SERIAL #endif #if defined(USE_I2S_AUDIO) || defined (USE_I2S) - AGPIO(GPIO_I2S_MCLK) + MAX_I2S -1, // I2S master clock - AGPIO(GPIO_I2S_BCLK) + MAX_I2S -1, // I2S bit clock - AGPIO(GPIO_I2S_DOUT) + MAX_I2S -1, // I2S Out Data - AGPIO(GPIO_I2S_DAC) + 2 -1, // I2S DAC Output - AGPIO(GPIO_I2S_WS) + MAX_I2S -1, // I2S word select - AGPIO(GPIO_I2S_DIN) + MAX_I2S -1, // I2S IN Data + AGPIO(GPIO_I2S_MCLK) + AGMAX(MAX_I2S), // I2S master clock + AGPIO(GPIO_I2S_BCLK) + AGMAX(MAX_I2S), // I2S bit clock + AGPIO(GPIO_I2S_DOUT) + AGMAX(MAX_I2S), // I2S Out Data + AGPIO(GPIO_I2S_DAC) + AGMAX(2), // I2S DAC Output + AGPIO(GPIO_I2S_WS) + AGMAX(MAX_I2S), // I2S word select + AGPIO(GPIO_I2S_DIN) + AGMAX(MAX_I2S), // I2S IN Data #endif #ifdef USE_SPI - AGPIO(GPIO_SPI_MISO) + MAX_SPI -1, // SPI MISO - AGPIO(GPIO_SPI_MOSI) + MAX_SPI -1, // SPI MOSI - AGPIO(GPIO_SPI_CLK) + MAX_SPI -1, // SPI Clk - AGPIO(GPIO_SPI_CS) + MAX_SPI -1, // SPI Chip Select - AGPIO(GPIO_SPI_DC) + MAX_SPI -1, // SPI Data Direction + AGPIO(GPIO_SPI_MISO) + AGMAX(MAX_SPI), // SPI MISO + AGPIO(GPIO_SPI_MOSI) + AGMAX(MAX_SPI), // SPI MOSI + AGPIO(GPIO_SPI_CLK) + AGMAX(MAX_SPI), // SPI Clk + AGPIO(GPIO_SPI_CS) + AGMAX(MAX_SPI), // SPI Chip Select + AGPIO(GPIO_SPI_DC) + AGMAX(MAX_SPI), // SPI Data Direction #ifdef USE_NRF24 AGPIO(GPIO_NRF24_CS), AGPIO(GPIO_NRF24_DC), #endif #ifdef USE_RC522 - AGPIO(GPIO_RC522_CS), // RC522 Rfid Chip Select - AGPIO(GPIO_RC522_RST), // RC522 Rfid Reset + AGPIO(GPIO_RC522_CS), // RC522 Rfid Chip Select + AGPIO(GPIO_RC522_RST), // RC522 Rfid Reset #endif #ifdef USE_SDCARD - AGPIO(GPIO_SDCARD_CS), // SDCard in SPI mode + AGPIO(GPIO_SDCARD_CS), // SDCard in SPI mode #endif // USE_SDCARD #if defined(USE_MCP2515) || defined(USE_CANSNIFFER) AGPIO(GPIO_MCP2515_CS), #endif // USE_MCP2515 #ifdef USE_MCP23XXX_DRV - AGPIO(GPIO_MCP23SXX_CS) + MAX_MCP23XXX -1, + AGPIO(GPIO_MCP23SXX_CS) + AGMAX(MAX_MCP23XXX), #endif // USE_MCP23XXX_DRV #ifdef USE_SPI_LORA AGPIO(GPIO_LORA_CS), @@ -658,25 +658,25 @@ const uint16_t kGpioNiceList[] PROGMEM = { #endif // USE_SPI #if defined(USE_SDCARD) && defined(ESP32) - AGPIO(GPIO_SDIO_CMD), // SDCard in SDIO mode + AGPIO(GPIO_SDIO_CMD), // SDCard in SDIO mode AGPIO(GPIO_SDIO_CLK), AGPIO(GPIO_SDIO_D0), - AGPIO(GPIO_SDIO_D1), // (opt) if in 4-bit mode, DAT1-3 are needed + AGPIO(GPIO_SDIO_D1), // (opt) if in 4-bit mode, DAT1-3 are needed AGPIO(GPIO_SDIO_D2), AGPIO(GPIO_SDIO_D3), #endif // USE_SDCARD - AGPIO(GPIO_SSPI_MISO), // Software SPI Master Input Client Output - AGPIO(GPIO_SSPI_MOSI), // Software SPI Master Output Client 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 + AGPIO(GPIO_SSPI_MISO), // Software SPI Master Input Client Output + AGPIO(GPIO_SSPI_MOSI), // Software SPI Master Output Client 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 #if defined(USE_DISPLAY) || defined(USE_LVGL) #ifdef USE_UNIVERSAL_TOUCH - AGPIO(GPIO_TS_SPI_CS), // Touch CS - AGPIO(GPIO_TS_RST), // Touch Reset - AGPIO(GPIO_TS_IRQ), // Touch IRQ + AGPIO(GPIO_TS_SPI_CS), // Touch CS + AGPIO(GPIO_TS_RST), // Touch Reset + AGPIO(GPIO_TS_IRQ), // Touch IRQ #endif // USE_UNIVERSAL_TOUCH // REMOVED // #ifdef USE_DISPLAY_ILI9341 @@ -685,7 +685,7 @@ const uint16_t kGpioNiceList[] PROGMEM = { // #endif // USE_DISPLAY_ILI9341 #ifdef USE_XPT2046 - AGPIO(GPIO_XPT2046_CS), // XPT2046 SPI Chip Select + AGPIO(GPIO_XPT2046_CS), // XPT2046 SPI Chip Select #endif #ifdef USE_DISPLAY_ILI9488 @@ -738,10 +738,10 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_TM1640CLK), AGPIO(GPIO_TM1640DIN), #endif // USE_DISPLAY_TM1640 - AGPIO(GPIO_BACKLIGHT), // Display backlight control - AGPIO(GPIO_OLED_RESET), // OLED Display Reset + AGPIO(GPIO_BACKLIGHT), // Display backlight control + AGPIO(GPIO_OLED_RESET), // OLED Display Reset #ifdef ESP32 - AGPIO(GPIO_EPD_DATA), // Base connection EPD driver + AGPIO(GPIO_EPD_DATA), // Base connection EPD driver #endif #endif // USE_DISPLAY @@ -754,37 +754,37 @@ const uint16_t kGpioNiceList[] PROGMEM = { #endif // USE_DISPLAY_TM1621_SONOFF #ifdef USE_MAX31865 - AGPIO(GPIO_SSPI_MAX31865_CS1) + MAX_MAX31865S -1, + AGPIO(GPIO_SSPI_MAX31865_CS1) + AGMAX(MAX_MAX31865S), #endif #ifdef USE_MCP23XXX_DRV - AGPIO(GPIO_MCP23XXX_INT) + MAX_MCP23XXX -1, + AGPIO(GPIO_MCP23XXX_INT) + AGMAX(MAX_MCP23XXX), #endif #ifdef USE_HDMI_CEC - AGPIO(GPIO_HDMI_CEC), // HDMI CEC bus + AGPIO(GPIO_HDMI_CEC), // HDMI CEC bus #endif - AGPIO(GPIO_TXD), // Serial interface - AGPIO(GPIO_RXD), // Serial interface + AGPIO(GPIO_TXD), // Serial interface + AGPIO(GPIO_RXD), // Serial interface /*-------------------------------------------------------------------------------------------*\ * Single wire sensors \*-------------------------------------------------------------------------------------------*/ #ifdef USE_DHT - AGPIO(GPIO_DHT11), // DHT11 - AGPIO(GPIO_DHT22), // DHT21, DHT22, AM2301, AM2302, AM2321 - AGPIO(GPIO_SI7021), // iTead SI7021 - AGPIO(GPIO_MS01), // Sonoff MS01 - AGPIO(GPIO_DHT11_OUT), // Pseudo Single wire DHT11, DHT21, DHT22, AM2301, AM2302, AM2321 + AGPIO(GPIO_DHT11), // DHT11 + AGPIO(GPIO_DHT22), // DHT21, DHT22, AM2301, AM2302, AM2321 + AGPIO(GPIO_SI7021), // iTead SI7021 + AGPIO(GPIO_MS01), // Sonoff MS01 + AGPIO(GPIO_DHT11_OUT), // Pseudo Single wire DHT11, DHT21, DHT22, AM2301, AM2302, AM2321 #endif #ifdef USE_DS18x20 - AGPIO(GPIO_DSB) + MAX_DSB -1, // Single wire DS18B20 or DS18S20 - AGPIO(GPIO_DSB_OUT) + MAX_DSB -1, // Pseudo Single wire DS18B20 or DS18S20 + AGPIO(GPIO_DSB) + AGMAX(MAX_DSB), // Single wire DS18B20 or DS18S20 + AGPIO(GPIO_DSB_OUT) + AGMAX(MAX_DSB), // Pseudo Single wire DS18B20 or DS18S20 #endif // USE_DS18x20 #ifdef USE_LMT01 - AGPIO(GPIO_LMT01), // LMT01, count pulses on GPIO + AGPIO(GPIO_LMT01), // LMT01, count pulses on GPIO #endif /*-------------------------------------------------------------------------------------------*\ @@ -794,47 +794,47 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef USE_LIGHT #ifdef USE_WS2812 #if (USE_WS2812_HARDWARE == NEO_HW_P9813) - AGPIO(GPIO_P9813_CLK), // P9813 CLOCK - AGPIO(GPIO_P9813_DAT), // P9813 DATA + AGPIO(GPIO_P9813_CLK), // P9813 CLOCK + AGPIO(GPIO_P9813_DAT), // P9813 DATA #else - AGPIO(GPIO_WS2812) + (MAX_RMT ? MAX_RMT + 1 : 1) -1, // WS2812 Led string, using RMT on ESP32 + AGPIO(GPIO_WS2812) + AGMAX(MAX_RMT), // WS2812 Led string, using RMT on ESP32 #endif // NEO_HW_P9813 #endif #ifdef USE_ARILUX_RF - AGPIO(GPIO_ARIRFRCV), // AriLux RF Receive input - AGPIO(GPIO_ARIRFSEL), // Arilux RF Receive input selected + 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 + 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 + 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) + MAX_SM2135_DAT -1, // SM2135 DATA + AGPIO(GPIO_SM2135_CLK), // SM2135 CLOCK + AGPIO(GPIO_SM2135_DAT) + AGMAX(MAX_SM2135_DAT), // SM2135 DATA #endif // USE_SM2135 #ifdef USE_SM2335 - AGPIO(GPIO_SM2335_CLK), // SM2335 CLOCK - AGPIO(GPIO_SM2335_DAT) + MAX_SM2335_DAT -1, // SM2335 DATA + AGPIO(GPIO_SM2335_CLK), // SM2335 CLOCK + AGPIO(GPIO_SM2335_DAT) + AGMAX(MAX_SM2335_DAT), // SM2335 DATA #endif // USE_SM2335 #ifdef USE_BP1658CJ - AGPIO(GPIO_BP1658CJ_CLK), // BP1658CJ CLOCK - AGPIO(GPIO_BP1658CJ_DAT) + MAX_BP1658CJ_DAT -1, // BP1658CJ DATA + AGPIO(GPIO_BP1658CJ_CLK), // BP1658CJ CLOCK + AGPIO(GPIO_BP1658CJ_DAT) + AGMAX(MAX_BP1658CJ_DAT), // BP1658CJ DATA #endif // USE_BP1658CJ #ifdef USE_BP5758D - AGPIO(GPIO_BP5758D_CLK), // BP5758D CLOCK - AGPIO(GPIO_BP5758D_DAT), // BP5758D DATA + AGPIO(GPIO_BP5758D_CLK), // BP5758D CLOCK + AGPIO(GPIO_BP5758D_DAT), // BP5758D DATA #endif // USE_BP5758D #ifdef USE_TUYA_MCU - AGPIO(GPIO_TUYA_TX), // Tuya Serial interface - AGPIO(GPIO_TUYA_RX), // Tuya Serial interface + 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 + AGPIO(GPIO_EXS_ENABLE), // EXS MCU Enable #endif #ifdef USE_ELECTRIQ_MOODL AGPIO(GPIO_ELECTRIQ_MOODL_TX), @@ -846,10 +846,10 @@ const uint16_t kGpioNiceList[] PROGMEM = { #endif // USE_LIGHT #ifdef USE_DALI - AGPIO(GPIO_DALI_TX), // DALI TX - AGPIO(GPIO_DALI_TX_INV), // DALI TX inverted - AGPIO(GPIO_DALI_RX), // DALI RX - AGPIO(GPIO_DALI_RX_INV), // DALI RX inverted + AGPIO(GPIO_DALI_TX), // DALI TX + AGPIO(GPIO_DALI_TX_INV), // DALI TX inverted + AGPIO(GPIO_DALI_RX), // DALI RX + AGPIO(GPIO_DALI_RX_INV), // DALI RX inverted #endif // USE_DALI /*-------------------------------------------------------------------------------------------*\ @@ -857,38 +857,38 @@ const uint16_t kGpioNiceList[] PROGMEM = { \*-------------------------------------------------------------------------------------------*/ #if defined(USE_IR_REMOTE) || defined(USE_IR_REMOTE_FULL) - AGPIO(GPIO_IRSEND) + MAX_IRSEND -1, // IR remote + AGPIO(GPIO_IRSEND) + AGMAX(MAX_IRSEND), // IR remote #if defined(USE_IR_RECEIVE) || defined(USE_IR_REMOTE_FULL) - AGPIO(GPIO_IRRECV), // IR receiver + AGPIO(GPIO_IRRECV), // IR receiver #endif #endif #ifdef USE_RC_SWITCH - AGPIO(GPIO_RFSEND), // RF transmitter - AGPIO(GPIO_RFRECV), // RF receiver + AGPIO(GPIO_RFSEND), // RF transmitter + AGPIO(GPIO_RFRECV), // RF receiver #endif #ifdef USE_RF_SENSOR - AGPIO(GPIO_RF_SENSOR), // Rf receiver with sensor decoding + AGPIO(GPIO_RF_SENSOR), // Rf receiver with sensor decoding #endif #ifdef USE_SR04 - AGPIO(GPIO_SR04_TRIG) + MAX_SR04 -1, // SR04 Tri/TXgger pin - AGPIO(GPIO_SR04_ECHO) + MAX_SR04 -1, // SR04 Ech/RXo pin + AGPIO(GPIO_SR04_TRIG) + AGMAX(MAX_SR04), // SR04 Tri/TXgger pin + AGPIO(GPIO_SR04_ECHO) + AGMAX(MAX_SR04), // SR04 Ech/RXo pin #endif #ifdef USE_ME007 - AGPIO(GPIO_ME007_TRIG), // ME007 Trigger pin (xsns_23_me007.ino) - AGPIO(GPIO_ME007_RX), // ME007 Rx pin (xsns_23_me007.ino) + AGPIO(GPIO_ME007_TRIG), // ME007 Trigger pin (xsns_23_me007.ino) + AGPIO(GPIO_ME007_RX), // ME007 Rx pin (xsns_23_me007.ino) #endif #ifdef USE_TM1638 - AGPIO(GPIO_TM1638CLK), // TM1638 Clock - AGPIO(GPIO_TM1638DIO), // TM1638 Data I/O - AGPIO(GPIO_TM1638STB), // TM1638 Strobe + AGPIO(GPIO_TM1638CLK), // TM1638 Clock + AGPIO(GPIO_TM1638DIO), // TM1638 Data I/O + AGPIO(GPIO_TM1638STB), // TM1638 Strobe #endif #ifdef USE_HX711 - AGPIO(GPIO_HX711_SCK), // HX711 Load Cell clock - AGPIO(GPIO_HX711_DAT), // HX711 Load Cell data + AGPIO(GPIO_HX711_SCK), // HX711 Load Cell clock + AGPIO(GPIO_HX711_DAT), // HX711 Load Cell data #endif #ifdef USE_TFMINIPLUS - AGPIO(GPIO_TFMINIPLUS_TX), // TFmini Plus TX pin - AGPIO(GPIO_TFMINIPLUS_RX), // TFmini Plus RX pin + AGPIO(GPIO_TFMINIPLUS_TX), // TFmini Plus TX pin + AGPIO(GPIO_TFMINIPLUS_RX), // TFmini Plus RX pin #endif /*-------------------------------------------------------------------------------------------*\ @@ -897,109 +897,109 @@ const uint16_t kGpioNiceList[] PROGMEM = { #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 + 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_ADE7880) - AGPIO(GPIO_ADE7880_IRQ) + 2 -1, // ADE7880 IRQ - (1 = IRQ1, 2 = IRQ2) + AGPIO(GPIO_ADE7880_IRQ) + AGMAX(2), // ADE7880 IRQ - (1 = IRQ1, 2 = IRQ2) #endif #ifdef USE_ADE7953 #if defined(USE_I2C) || defined(USE_SPI) - AGPIO(GPIO_ADE7953_IRQ) + 6 -1, // ADE7953 IRQ - (1 = Shelly 2.5, 2 = Shelly EM, 3 = Shelly Plus 2PM, 4 = Shelly Pro 1PM, 5 = Shelly Pro 2PM, 6 = Shelly Pro 4PM) - AGPIO(GPIO_ADE7953_RST), // ADE7953 Reset + AGPIO(GPIO_ADE7953_IRQ) + AGMAX(6), // ADE7953 IRQ - (1 = Shelly 2.5, 2 = Shelly EM, 3 = Shelly Plus 2PM, 4 = Shelly Pro 1PM, 5 = Shelly Pro 2PM, 6 = Shelly Pro 4PM) + AGPIO(GPIO_ADE7953_RST), // ADE7953 Reset #ifdef USE_SPI - AGPIO(GPIO_ADE7953_CS) + 2 -1, // ADE7953 SPI Chip Select (1 = CS1 (1PM, 2PM), 2 = CS2 (2PM)) + AGPIO(GPIO_ADE7953_CS) + AGMAX(2), // ADE7953 SPI Chip Select (1 = CS1 (1PM, 2PM), 2 = CS2 (2PM)) #endif // USE_SPI #endif // USE_I2C or USE_SPI #endif // USE_ADE7953 #ifdef USE_CSE7761 - AGPIO(GPIO_CSE7761_TX), // CSE7761 Serial interface (Dual R3) - AGPIO(GPIO_CSE7761_RX) + MAX_CSE7761 -1, // CSE7761 Serial interface (1 = Dual R3, 2 = POWCT) + AGPIO(GPIO_CSE7761_TX), // CSE7761 Serial interface (Dual R3) + AGPIO(GPIO_CSE7761_RX) + AGMAX(MAX_CSE7761), // CSE7761 Serial interface (1 = Dual R3, 2 = POWCT) #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) + 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) + AGPIO(GPIO_MCP39F5_TX), // MCP39F501 Serial interface (Shelly2) + AGPIO(GPIO_MCP39F5_RX), // MCP39F501 Serial interface (Shelly2) + AGPIO(GPIO_MCP39F5_RST), // MCP39F501 Reset (Shelly2) #endif - AGPIO(GPIO_NRG_MBS_TX_ENA), // Generic Energy Modbus Transmit Enable + AGPIO(GPIO_NRG_MBS_TX_ENA), // Generic Energy Modbus Transmit Enable #if defined(USE_PZEM004T) || defined(USE_PZEM_AC) || defined(USE_PZEM_DC) - AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface + AGPIO(GPIO_PZEM0XX_TX), // PZEM0XX Serial interface #endif #ifdef USE_PZEM004T - AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface + AGPIO(GPIO_PZEM004_RX), // PZEM004T Serial interface #endif #ifdef USE_PZEM_AC - AGPIO(GPIO_PZEM016_RX), // PZEM-014,016 Serial Modbus interface + 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 + AGPIO(GPIO_PZEM017_RX), // PZEM-003,017 Serial Modbus interface #endif #ifdef USE_MODBUS_ENERGY - AGPIO(GPIO_NRG_MBS_TX), // Generic Energy Modbus device + AGPIO(GPIO_NRG_MBS_TX), // Generic Energy Modbus device AGPIO(GPIO_NRG_MBS_RX), #endif #ifdef USE_SDM120 - AGPIO(GPIO_SDM120_TX), // SDM120 Serial interface - AGPIO(GPIO_SDM120_RX), // SDM120 Serial interface + 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 + 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 + 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 + 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 - AGPIO(GPIO_SOLAXX1_RTS), // Solax Inverter RTS pin + AGPIO(GPIO_SOLAXX1_TX), // Solax Inverter tx pin + AGPIO(GPIO_SOLAXX1_RX), // Solax Inverter rx pin + AGPIO(GPIO_SOLAXX1_RTS), // Solax Inverter RTS pin #endif // USE_SOLAX_X1 #ifdef USE_LE01MR - AGPIO(GPIO_LE01MR_TX), // F7F LE-01MR energy meter tx pin - AGPIO(GPIO_LE01MR_RX), // F7F LE-01MR energy meter rx pin + AGPIO(GPIO_LE01MR_TX), // F7F LE-01MR energy meter tx pin + AGPIO(GPIO_LE01MR_RX), // F7F LE-01MR energy meter rx pin #endif // USE_LE01MR #ifdef ESP32 #ifdef USE_BL0906 - AGPIO(GPIO_BL0906_RX) + MAX_BL0906_RX -1, // BL0906 Serial interface (Athom EM6) + AGPIO(GPIO_BL0906_RX) + AGMAX(MAX_BL0906_RX), // BL0906 Serial interface (Athom EM6) #endif // USE_BL0906 #endif // ESP32 #if defined(USE_BL0940) || defined(USE_BL09XX) - AGPIO(GPIO_BL0939_RX), // BL0939 Serial interface (Dual R3 v2) - AGPIO(GPIO_BL0940_RX), // BL0940 Serial interface - AGPIO(GPIO_BL0942_RX) + MAX_BL0942_RX -1, // BL0942 Serial interface + AGPIO(GPIO_BL0939_RX), // BL0939 Serial interface (Dual R3 v2) + AGPIO(GPIO_BL0940_RX), // BL0940 Serial interface + AGPIO(GPIO_BL0942_RX) + AGMAX(MAX_BL0942_RX), // BL0942 Serial interface #endif #ifdef USE_IEM3000 - AGPIO(GPIO_IEM3000_TX), // IEM3000 Serial interface - AGPIO(GPIO_IEM3000_RX), // IEM3000 Serial interface + AGPIO(GPIO_IEM3000_TX), // IEM3000 Serial interface + AGPIO(GPIO_IEM3000_RX), // IEM3000 Serial interface #endif #ifdef USE_WE517 - AGPIO(GPIO_WE517_TX), // WE517 Serial interface - AGPIO(GPIO_WE517_RX), // WE517 Serial interface + AGPIO(GPIO_WE517_TX), // WE517 Serial interface + AGPIO(GPIO_WE517_RX), // WE517 Serial interface #endif #ifdef USE_SDM72 - AGPIO(GPIO_SDM72_TX), // SDM72 Serial interface - AGPIO(GPIO_SDM72_RX), // SDM72 Serial interface + AGPIO(GPIO_SDM72_TX), // SDM72 Serial interface + AGPIO(GPIO_SDM72_RX), // SDM72 Serial interface #endif AGPIO(GPIO_ZEROCROSS), #ifdef USE_SDM230 - AGPIO(GPIO_SDM230_TX), // SDM230 Serial interface - AGPIO(GPIO_SDM230_RX), // SDM230 Serial interface + AGPIO(GPIO_SDM230_TX), // SDM230 Serial interface + AGPIO(GPIO_SDM230_RX), // SDM230 Serial interface #endif #ifdef USE_BL6523 - AGPIO(GPIO_BL6523_TX), // BL6523 based Watt meter Serial interface - AGPIO(GPIO_BL6523_RX), // BL6523 based Watt meter Serial interface + AGPIO(GPIO_BL6523_TX), // BL6523 based Watt meter Serial interface + AGPIO(GPIO_BL6523_RX), // BL6523 based Watt meter Serial interface #endif #endif // USE_ENERGY_SENSOR @@ -1008,134 +1008,134 @@ const uint16_t kGpioNiceList[] PROGMEM = { \*-------------------------------------------------------------------------------------------*/ #ifdef USE_SERIAL_BRIDGE - AGPIO(GPIO_SBR_TX), // Serial Bridge Serial interface - AGPIO(GPIO_SBR_RX), // Serial Bridge Serial interface + AGPIO(GPIO_SBR_TX), // Serial Bridge Serial interface + AGPIO(GPIO_SBR_RX), // Serial Bridge Serial interface #endif #ifdef USE_MODBUS_BRIDGE - AGPIO(GPIO_MBR_TX_ENA), // Modbus Bridge Serial interface - AGPIO(GPIO_MBR_TX), // Modbus Bridge Serial interface - AGPIO(GPIO_MBR_RX), // Modbus Bridge Serial interface + AGPIO(GPIO_MBR_TX_ENA), // Modbus Bridge Serial interface + AGPIO(GPIO_MBR_TX), // Modbus Bridge Serial interface + AGPIO(GPIO_MBR_RX), // Modbus Bridge Serial interface #endif #ifdef USE_TCP_BRIDGE - AGPIO(GPIO_TCP_TX), // TCP Serial bridge - AGPIO(GPIO_TCP_RX), // TCP Serial bridge - AGPIO(GPIO_TCP_TX_EN), // TCP Serial bridge EN + AGPIO(GPIO_TCP_TX), // TCP Serial bridge + AGPIO(GPIO_TCP_RX), // TCP Serial bridge + AGPIO(GPIO_TCP_TX_EN), // TCP Serial bridge EN #endif #ifdef USE_ZIGBEE - AGPIO(GPIO_ZIGBEE_TX), // Zigbee Serial interface - AGPIO(GPIO_ZIGBEE_RX), // Zigbee Serial interface - AGPIO(GPIO_ZIGBEE_RST) + 2 -1, // Zigbee reset, pin 1 is reset, pin 2 is bootloader mode + AGPIO(GPIO_ZIGBEE_TX), // Zigbee Serial interface + AGPIO(GPIO_ZIGBEE_RX), // Zigbee Serial interface + AGPIO(GPIO_ZIGBEE_RST) + AGMAX(2), // Zigbee reset, pin 1 is reset, pin 2 is bootloader mode #endif #ifdef USE_MHZ19 - AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface - AGPIO(GPIO_MHZ_RXD), // MH-Z19 Serial interface + AGPIO(GPIO_MHZ_TXD), // MH-Z19 Serial interface + AGPIO(GPIO_MHZ_RXD), // MH-Z19 Serial interface #endif #ifdef USE_HC8 - AGPIO(GPIO_HC8_RXD), // HC8 Serial interface + AGPIO(GPIO_HC8_RXD), // HC8 Serial interface #endif #ifdef USE_SENSEAIR - AGPIO(GPIO_SAIR_TX), // SenseAir Serial interface - AGPIO(GPIO_SAIR_RX), // SenseAir Serial interface + 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 + 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 + 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 + AGPIO(GPIO_PMS5003_TX), // Plantower PMS5003 Serial interface + AGPIO(GPIO_PMS5003_RX), // Plantower PMS5003 Serial interface #endif #ifdef USE_VINDRIKTNING - AGPIO(GPIO_VINDRIKTNING_RX), // Ikea Vindriktning + AGPIO(GPIO_VINDRIKTNING_RX), // Ikea Vindriktning #endif #ifdef USE_HM330X - AGPIO(GPIO_HM330X_SET), // HM330X Sleep pin (active low) + AGPIO(GPIO_HM330X_SET), // HM330X Sleep pin (active low) #endif #if defined(USE_TX20_WIND_SENSOR) || defined(USE_TX23_WIND_SENSOR) || defined(USE_WS2300_WIND_SENSOR) - AGPIO(GPIO_TX2X_TXD_BLACK), // TX20/TX23 Transmission Pin + AGPIO(GPIO_TX2X_TXD_BLACK), // TX20/TX23 Transmission Pin #endif -#ifdef USE_WINDMETER // xsns_68_windmeter.ino +#ifdef USE_WINDMETER AGPIO(GPIO_WINDMETER_SPEED), #endif -#ifdef USE_MP3_PLAYER // xdrv_14_mp3.ino - AGPIO(GPIO_MP3_DFR562), // RB-DFR-562, DFPlayer Mini MP3 Player Serial interface - AGPIO(GPIO_MP3_DFR562_BUSY), // RB-DFR-562, DFPlayer Mini MP3 Player optional Busy flag +#ifdef USE_MP3_PLAYER + AGPIO(GPIO_MP3_DFR562), // RB-DFR-562, DFPlayer Mini MP3 Player Serial interface + AGPIO(GPIO_MP3_DFR562_BUSY), // RB-DFR-562, DFPlayer Mini MP3 Player optional Busy flag #endif -#ifdef USE_AZ7798 // xsns_38_az7798 - AGPIO(GPIO_AZ_TXD), // AZ-Instrument 7798 CO2 datalogger Serial interface - AGPIO(GPIO_AZ_RXD), // AZ-Instrument 7798 CO2 datalogger Serial interface +#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 // xsns_40_pn532.ino - AGPIO(GPIO_PN532_TXD), // PN532 HSU Tx - AGPIO(GPIO_PN532_RXD), // PN532 HSU Rx +#ifdef USE_PN532_HSU + AGPIO(GPIO_PN532_TXD), // PN532 HSU Tx + AGPIO(GPIO_PN532_RXD), // PN532 HSU Rx #endif -#ifdef USE_TASMOTA_CLIENT // xdrv_31_tasmota_client.ino - AGPIO(GPIO_TASMOTACLIENT_TXD), // Tasmota Client TX - AGPIO(GPIO_TASMOTACLIENT_RXD), // Tasmota Client RX - AGPIO(GPIO_TASMOTACLIENT_RST), // Tasmota Client Reset - AGPIO(GPIO_TASMOTACLIENT_RST_INV), // Tasmota Client Reset Inverted +#ifdef USE_TASMOTA_CLIENT + AGPIO(GPIO_TASMOTACLIENT_TXD), // Tasmota Client TX + AGPIO(GPIO_TASMOTACLIENT_RXD), // Tasmota Client RX + AGPIO(GPIO_TASMOTACLIENT_RST), // Tasmota Client Reset + AGPIO(GPIO_TASMOTACLIENT_RST_INV), // Tasmota Client Reset Inverted #endif -#ifdef USE_RDM6300 // xsns_51_rdm6300.ino +#ifdef USE_RDM6300 AGPIO(GPIO_RDM6300_RX), #endif -#ifdef USE_IBEACON // xsns_52_ibeacon.ino +#ifdef USE_IBEACON AGPIO(GPIO_IBEACON_TX), AGPIO(GPIO_IBEACON_RX), #endif -#ifdef USE_GPS // xsns_60_gps.ino - AGPIO(GPIO_GPS_TX), // GPS serial interface - AGPIO(GPIO_GPS_RX), // GPS serial interface +#ifdef USE_GPS + AGPIO(GPIO_GPS_TX), // GPS serial interface + AGPIO(GPIO_GPS_RX), // GPS serial interface #endif -#ifdef USE_HM10 // xsns_62_mi_hm10.ino - AGPIO(GPIO_HM10_TX), // HM10 serial interface - AGPIO(GPIO_HM10_RX), // HM10 serial interface +#ifdef USE_HM10 + AGPIO(GPIO_HM10_TX), // HM10 serial interface + AGPIO(GPIO_HM10_RX), // HM10 serial interface #endif -#ifdef USE_OPENTHERM // xsns_69_opentherm.ino +#ifdef USE_OPENTHERM AGPIO(GPIO_BOILER_OT_TX), AGPIO(GPIO_BOILER_OT_RX), #endif -#ifdef USE_AS608 // xsns_79_as608.ino +#ifdef USE_AS608 AGPIO(GPIO_AS608_TX), AGPIO(GPIO_AS608_RX), #endif -#ifdef USE_GM861 // xsns_107_gm861.ino +#ifdef USE_GM861 AGPIO(GPIO_GM861_TX), AGPIO(GPIO_GM861_RX), #endif -#ifdef USE_HRG15 // xsns_90_hrg15.ino +#ifdef USE_HRG15 AGPIO(GPIO_HRG15_TX), AGPIO(GPIO_HRG15_RX), #endif -#ifdef USE_CM110x // xsns_95_cm110x.ino - AGPIO(GPIO_CM11_TXD), // CM110x Serial interface - AGPIO(GPIO_CM11_RXD), // CM110x Serial interface +#ifdef USE_CM110x + AGPIO(GPIO_CM11_TXD), // CM110x Serial interface + AGPIO(GPIO_CM11_RXD), // CM110x Serial interface #endif -#ifdef USE_LD2410 // xsns_102_ld2410.ino - AGPIO(GPIO_LD2410_TX), // HLK-LD2410 Serial interface - AGPIO(GPIO_LD2410_RX), // HLK-LD2410 Serial interface +#ifdef USE_LD2410 + AGPIO(GPIO_LD2410_TX), // HLK-LD2410 Serial interface + AGPIO(GPIO_LD2410_RX), // HLK-LD2410 Serial interface #endif -#ifdef USE_LD2410S // xsns_102_ld2410s.ino - AGPIO(GPIO_LD2410S_TX), // HLK-LD2410S Serial interface - AGPIO(GPIO_LD2410S_RX), // HLK-LD2410S Serial interface +#ifdef USE_LD2410S + AGPIO(GPIO_LD2410S_TX), // HLK-LD2410S Serial interface + AGPIO(GPIO_LD2410S_RX), // HLK-LD2410S Serial interface #endif -#ifdef USE_LOX_O2 // xsns_105_lox_o2.ino - AGPIO(GPIO_LOX_O2_RX), // LuminOx Oxygen Sensor LOX-O2 Serial interface +#ifdef USE_LOX_O2 + AGPIO(GPIO_LOX_O2_RX), // LuminOx Oxygen Sensor LOX-O2 Serial interface #endif #ifdef USE_LORAWAN_RN2XX3 AGPIO(GPIO_RN2XX3_TX), AGPIO(GPIO_RN2XX3_RX), - AGPIO(GPIO_RN2XX3_RST), // RN2XX3 LoRaWan node Serial interface + AGPIO(GPIO_RN2XX3_RST), // RN2XX3 LoRaWan node Serial interface #endif #ifdef USE_LORAWAN_ASR650X AGPIO(GPIO_ASR650X_TX), - AGPIO(GPIO_ASR650X_RX), // ASR650X LoRaWan node Serial interface + AGPIO(GPIO_ASR650X_RX), // ASR650X LoRaWan node Serial interface #endif -#ifdef USE_WOOLIIS // xsns_115_wooliis.ino - AGPIO(GPIO_WOOLIIS_RX), // Wooliis Battery capacity monitor Serial interface +#ifdef USE_WOOLIIS + AGPIO(GPIO_WOOLIIS_RX), // Wooliis Battery capacity monitor Serial interface #endif /*-------------------------------------------------------------------------------------------*\ @@ -1147,27 +1147,27 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_MGC3130_RESET), #endif #ifdef USE_MAX31855 - AGPIO(GPIO_MAX31855CS) + MAX_MAX31855S -1, //MAX31855 Serial interface - AGPIO(GPIO_MAX31855CLK), // MAX31855 Serial interface - AGPIO(GPIO_MAX31855DO), // MAX31855 Serial interface + AGPIO(GPIO_MAX31855CS) + AGMAX(MAX_MAX31855S), // MAX31855 Serial interface + AGPIO(GPIO_MAX31855CLK), // MAX31855 Serial interface + AGPIO(GPIO_MAX31855DO), // MAX31855 Serial interface #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 + 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) + MAX_A4988_MSS -1, // A4988 microstep pin1 to pin3 + AGPIO(GPIO_A4988_ENA), // A4988 enabled pin + AGPIO(GPIO_A4988_MS1) + AGMAX(MAX_A4988_MSS), // A4988 microstep pin1 to 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 + AGPIO(GPIO_CC1101_GDO0), // CC1101 pin for RX + AGPIO(GPIO_CC1101_GDO2), // CC1101 pin for RX #endif #ifdef USE_HRXL AGPIO(GPIO_HRXL_RX), @@ -1176,48 +1176,48 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_DYP_RX), #endif #ifdef USE_AS3935 - AGPIO(GPIO_AS3935), // AS3935 IRQ Pin + AGPIO(GPIO_AS3935), // AS3935 IRQ Pin #endif #ifdef USE_TELEINFO AGPIO(GPIO_TELEINFO_RX), AGPIO(GPIO_TELEINFO_ENABLE), #endif #ifdef USE_MIEL_HVAC - AGPIO(GPIO_MIEL_HVAC_TX), // Mitsubishi Electric HVAC TX pin - AGPIO(GPIO_MIEL_HVAC_RX), // Mitsubishi Electric HVAC RX pin + AGPIO(GPIO_MIEL_HVAC_TX), // Mitsubishi Electric HVAC TX pin + AGPIO(GPIO_MIEL_HVAC_RX), // Mitsubishi Electric HVAC RX pin #endif #ifdef USE_TUYAMCUBR AGPIO(GPIO_TUYAMCUBR_TX), AGPIO(GPIO_TUYAMCUBR_RX), #endif #ifdef USE_WIEGAND - AGPIO(GPIO_WIEGAND_D0), // Date line D0 of Wiegand devices - AGPIO(GPIO_WIEGAND_D1), // Date line D1 of Wiegand devices + AGPIO(GPIO_WIEGAND_D0), // Data line D0 of Wiegand devices + AGPIO(GPIO_WIEGAND_D1), // Data line D1 of Wiegand devices #endif #ifdef USE_NEOPOOL - AGPIO(GPIO_NEOPOOL_TX), // Sugar Valley RS485 Interface - AGPIO(GPIO_NEOPOOL_RX), // Sugar Valley RS485 Interface + AGPIO(GPIO_NEOPOOL_TX), // Sugar Valley RS485 Interface + AGPIO(GPIO_NEOPOOL_RX), // Sugar Valley RS485 Interface #endif #ifdef USE_PROJECTOR_CTRL - AGPIO(GPIO_PROJECTOR_CTRL_TX), // LCD/DLP Projector Serial Control - AGPIO(GPIO_PROJECTOR_CTRL_RX), // LCD/DLP Projector Serial Control + AGPIO(GPIO_PROJECTOR_CTRL_TX), // LCD/DLP Projector Serial Control + AGPIO(GPIO_PROJECTOR_CTRL_RX), // LCD/DLP Projector Serial Control #endif #if defined(USE_VL53L0X) or defined (USE_VL53L1X) - AGPIO(GPIO_VL53LXX_XSHUT1) + VL53LXX_MAX_SENSORS -1, // When using multiple VL53LXX. + AGPIO(GPIO_VL53LXX_XSHUT1) + AGMAX(VL53LXX_MAX_SENSORS), // When using multiple VL53LXX. #endif #ifdef USE_FLOWRATEMETER - AGPIO(GPIO_FLOWRATEMETER_IN) + MAX_FLOWRATEMETER -1, // Flow meter Pin + AGPIO(GPIO_FLOWRATEMETER_IN) + AGMAX(MAX_FLOWRATEMETER), // Flow meter Pin #endif #ifdef USE_SHIFT595 - AGPIO(GPIO_SHIFT595_SRCLK), // 74x595 shift register + AGPIO(GPIO_SHIFT595_SRCLK), // 74x595 shift register AGPIO(GPIO_SHIFT595_RCLK), AGPIO(GPIO_SHIFT595_OE), AGPIO(GPIO_SHIFT595_SER), #endif #if defined (ESP32) && defined(USE_DINGTIAN_RELAY) - AGPIO(GPIO_DINGTIAN_CLK) + MAX_DINGTIAN_SHIFT -1, // Dingtian Relay board - 8,16,24 or 32 relays & inputs + AGPIO(GPIO_DINGTIAN_CLK) + AGMAX(MAX_DINGTIAN_SHIFT), // Dingtian Relay board - 8,16,24 or 32 relays & inputs AGPIO(GPIO_DINGTIAN_SDI), AGPIO(GPIO_DINGTIAN_Q7), AGPIO(GPIO_DINGTIAN_PL), @@ -1226,12 +1226,12 @@ const uint16_t kGpioNiceList[] PROGMEM = { #endif #ifdef USE_MAGIC_SWITCH - AGPIO(GPIO_MAGIC_SWITCH) + MAX_MAGIC_SWITCH_MODES -1, + AGPIO(GPIO_MAGIC_SWITCH) + AGMAX(MAX_MAGIC_SWITCH_MODES), #endif -#ifdef USE_PIPSOLAR // xdrv_92_pipsolar.ino - AGPIO(GPIO_PIPSOLAR_TX), // pipsolar inverter Serial interface - AGPIO(GPIO_PIPSOLAR_RX), // pipsolar inverter Serial interface +#ifdef USE_PIPSOLAR + AGPIO(GPIO_PIPSOLAR_TX), // pipsolar inverter Serial interface + AGPIO(GPIO_PIPSOLAR_RX), // pipsolar inverter Serial interface #endif /*-------------------------------------------------------------------------------------------*\ @@ -1240,7 +1240,7 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef ESP32 #if CONFIG_IDF_TARGET_ESP32 - AGPIO(GPIO_HALLEFFECT) + 2 -1, // Hall effect sensor connected to GPIO36 and 39 + AGPIO(GPIO_HALLEFFECT) + AGMAX(2), // Hall effect sensor connected to GPIO36 and 39 #endif // CONFIG_IDF_TARGET_ESP32 #ifdef USE_WEBCAM AGPIO(GPIO_WEBCAM_PWDN), @@ -1248,41 +1248,41 @@ const uint16_t kGpioNiceList[] PROGMEM = { AGPIO(GPIO_WEBCAM_XCLK), AGPIO(GPIO_WEBCAM_SIOD), AGPIO(GPIO_WEBCAM_SIOC), - AGPIO(GPIO_WEBCAM_DATA) + MAX_WEBCAM_DATA -1, + AGPIO(GPIO_WEBCAM_DATA) + AGMAX(MAX_WEBCAM_DATA), AGPIO(GPIO_WEBCAM_VSYNC), AGPIO(GPIO_WEBCAM_HREF), AGPIO(GPIO_WEBCAM_PCLK), AGPIO(GPIO_WEBCAM_PSCLK), - AGPIO(GPIO_WEBCAM_HSD) + MAX_WEBCAM_HSD -1, + AGPIO(GPIO_WEBCAM_HSD) + AGMAX(MAX_WEBCAM_HSD), AGPIO(GPIO_WEBCAM_PSRCS), #endif // USE_WEBCAM #ifdef USE_ETHERNET AGPIO(GPIO_ETH_PHY_POWER), AGPIO(GPIO_ETH_PHY_MDC), - AGPIO(GPIO_ETH_PHY_MDIO), // Ethernet + AGPIO(GPIO_ETH_PHY_MDIO), // Ethernet #endif // USE_ETHERNET #ifdef USE_BIOPDU - AGPIO(GPIO_BIOPDU_PZEM0XX_TX), // Biomine BioPDU pins + AGPIO(GPIO_BIOPDU_PZEM0XX_TX), // Biomine BioPDU pins AGPIO(GPIO_BIOPDU_PZEM016_RX), - AGPIO(GPIO_BIOPDU_BIT) + 3 -1, + AGPIO(GPIO_BIOPDU_BIT) + AGMAX(3), #endif /*-------------------------------------------------------------------------------------------*\ * ESP32 multiple Analog / Digital converter inputs \*-------------------------------------------------------------------------------------------*/ - AGPIO(GPIO_ADC_INPUT) + MAX_ADCS -1, // Analog inputs - AGPIO(GPIO_ADC_TEMP) + MAX_ADCS -1, // Thermistor - AGPIO(GPIO_ADC_LIGHT) + MAX_ADCS -1, // Light sensor - AGPIO(GPIO_ADC_BUTTON) + MAX_KEYS -1, // Button - AGPIO(GPIO_ADC_BUTTON_INV) + MAX_KEYS -1, - AGPIO(GPIO_ADC_RANGE) + MAX_ADCS -1, // Range - AGPIO(GPIO_ADC_CT_POWER) + MAX_ADCS -1, // Current - AGPIO(GPIO_ADC_JOY) + MAX_ADCS -1, // Joystick - AGPIO(GPIO_ADC_PH) + MAX_ADCS -1, // Analog PH Sensor - AGPIO(GPIO_ADC_MQ) + MAX_ADCS -1, // Analog MQ Sensor - AGPIO(GPIO_ADC_VOLTAGE) + MAX_ADCS -1, // Voltage - AGPIO(GPIO_ADC_CURRENT) + MAX_ADCS -1, // Current + AGPIO(GPIO_ADC_INPUT) + AGMAX(MAX_ADCS), // Analog inputs + AGPIO(GPIO_ADC_TEMP) + AGMAX(MAX_ADCS), // Thermistor + AGPIO(GPIO_ADC_LIGHT) + AGMAX(MAX_ADCS), // Light sensor + AGPIO(GPIO_ADC_BUTTON) + AGMAX(MAX_KEYS), // Button + AGPIO(GPIO_ADC_BUTTON_INV) + AGMAX(MAX_KEYS), + AGPIO(GPIO_ADC_RANGE) + AGMAX(MAX_ADCS), // Range + AGPIO(GPIO_ADC_CT_POWER) + AGMAX(MAX_ADCS), // Current + AGPIO(GPIO_ADC_JOY) + AGMAX(MAX_ADCS), // Joystick + AGPIO(GPIO_ADC_PH) + AGMAX(MAX_ADCS), // Analog PH Sensor + AGPIO(GPIO_ADC_MQ) + AGMAX(MAX_ADCS), // Analog MQ Sensor + AGPIO(GPIO_ADC_VOLTAGE) + AGMAX(MAX_ADCS), // Voltage + AGPIO(GPIO_ADC_CURRENT) + AGMAX(MAX_ADCS), // Current #endif // ESP32 }; @@ -1292,19 +1292,19 @@ const uint16_t kGpioNiceList[] PROGMEM = { #ifdef ESP8266 const uint16_t kAdcNiceList[] PROGMEM = { - GPIO_NONE, // Not used - AGPIO(GPIO_ADC_INPUT), // Analog inputs - AGPIO(GPIO_ADC_TEMP), // Thermistor - AGPIO(GPIO_ADC_LIGHT), // Light sensor - AGPIO(GPIO_ADC_BUTTON) + MAX_KEYS -1, // Button - AGPIO(GPIO_ADC_BUTTON_INV) + MAX_KEYS -1, - AGPIO(GPIO_ADC_RANGE), // Range - AGPIO(GPIO_ADC_CT_POWER), // Current - AGPIO(GPIO_ADC_JOY), // Joystick - AGPIO(GPIO_ADC_PH), // Analog PH Sensor - AGPIO(GPIO_ADC_MQ), // Analog MQ Sensor - AGPIO(GPIO_ADC_VOLTAGE), // Voltage - AGPIO(GPIO_ADC_CURRENT), // Current + GPIO_NONE, // Not used + AGPIO(GPIO_ADC_INPUT), // Analog inputs + AGPIO(GPIO_ADC_TEMP), // Thermistor + AGPIO(GPIO_ADC_LIGHT), // Light sensor + AGPIO(GPIO_ADC_BUTTON) + AGMAX(MAX_KEYS), // Button + AGPIO(GPIO_ADC_BUTTON_INV) + AGMAX(MAX_KEYS), + AGPIO(GPIO_ADC_RANGE), // Range + AGPIO(GPIO_ADC_CT_POWER), // Current + AGPIO(GPIO_ADC_JOY), // Joystick + AGPIO(GPIO_ADC_PH), // Analog PH Sensor + AGPIO(GPIO_ADC_MQ), // Analog MQ Sensor + AGPIO(GPIO_ADC_VOLTAGE), // Voltage + AGPIO(GPIO_ADC_CURRENT), // Current }; #endif // ESP8266 diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index e1ed6a7da..2c25cdd28 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -1805,7 +1805,7 @@ void CmndGpio(void) if (ValidGPIO(XdrvMailbox.index, template_gp.io[XdrvMailbox.index]) && (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < AGPIO(GPIO_SENSOR_END))) { bool present = false; for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) { - uint32_t midx = pgm_read_word(kGpioNiceList + i); + uint32_t midx = pgm_read_word(&kGpioNiceList[i]); uint32_t max_midx = ((midx & 0x001F) > 0) ? midx : midx +1; if ((XdrvMailbox.payload >= (midx & 0xFFE0)) && (XdrvMailbox.payload < max_midx)) { present = true; @@ -1843,7 +1843,7 @@ void CmndGpio(void) uint32_t sensor_name_idx = BGPIO(sensor_type); uint32_t nice_list_search = sensor_type & 0xFFE0; for (uint32_t j = 0; j < nitems(kGpioNiceList); j++) { - uint32_t nls_idx = pgm_read_word(kGpioNiceList + j); + uint32_t nls_idx = pgm_read_word(&kGpioNiceList[j]); if (((nls_idx & 0xFFE0) == nice_list_search) && ((nls_idx & 0x001F) > 0)) { snprintf_P(sindex, sizeof(sindex), PSTR("%d"), (sensor_type & 0x001F) +1); break; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 856c9a46d..3bc5634c5 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -1932,7 +1932,7 @@ void WSContentSendNiceLists(uint32_t option) { if (option && (1 == i)) { WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), PSTR(D_SENSOR_USER)); // }2'255'>User}3 } - uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0; + uint32_t ridx = pgm_read_word(&kGpioNiceList[i]) & 0xFFE0; uint32_t midx = BGPIO(ridx); WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames)); } @@ -1942,7 +1942,7 @@ void WSContentSendNiceLists(uint32_t option) { uint32_t midx; bool first_done = false; for (uint32_t i = 0; i < nitems(kGpioNiceList); i++) { // hs=[36,68,100,132,168,200,232,264,292,324,356,388,421,453]; - midx = pgm_read_word(kGpioNiceList + i); + midx = pgm_read_word(&kGpioNiceList[i]); if (midx & 0x001F) { if (first_done) { WSContentSend_P(PSTR(",")); } WSContentSend_P(PSTR("%d"), midx);