diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index e08a486ce..647217911 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -652,7 +652,7 @@ #define SDM120_SPEED 2400 // SDM120-Modbus RS485 serial speed (default: 2400 baud) //#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy monitor (+0k6 code) #define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud) -// #define SDM630_IMPORT // Show import active energy in MQTT and Web (+0k3 code) +// #define SDM630_IMPORT // Show import active energy in MQTT and Web (+0k3 code) //#define USE_DDS2382 // Add support for Hiking DDS2382 Modbus energy monitor (+0k6 code) #define DDS2382_SPEED 9600 // Hiking DDS2382 Modbus RS485 serial speed (default: 9600 baud) //#define USE_DDSU666 // Add support for Chint DDSU666 Modbus energy monitor (+0k6 code) diff --git a/tasmota/support.ino b/tasmota/support.ino index a0d515d24..ce5a523f1 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -1218,9 +1218,14 @@ void DumpConvertTable(void) { uint32_t ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index = 0); uint32_t ICACHE_RAM_ATTR Pin(uint32_t gpio, uint32_t index) { - uint16_t real_gpio = (gpio << 5) + index; + uint16_t real_gpio = gpio << 5; + uint16_t mask = 0xFFE0; + if (index < GPIO_ANY) { + real_gpio += index; + mask = 0xFFFF; + } for (uint32_t i = 0; i < ARRAY_SIZE(gpio_pin); i++) { - if (gpio_pin[i] == real_gpio) { + if ((gpio_pin[i] & mask) == real_gpio) { return i; // Pin number configured for gpio } } diff --git a/tasmota/tasmota_template.h b/tasmota/tasmota_template.h index b62240e49..0099a46e8 100644 --- a/tasmota/tasmota_template.h +++ b/tasmota/tasmota_template.h @@ -695,6 +695,8 @@ enum UserSelectableAdc { * ATTENTION: No user changeable features beyond this point - do not add templates !!! \*********************************************************************************************/ +#define GPIO_ANY 32 // Any GPIO + #ifdef ESP8266 #define MAX_GPI8_PIN 17 // Number of supported GPIO (0..16) diff --git a/tasmota/xsns_47_max31865.ino b/tasmota/xsns_47_max31865.ino index c45b13927..adf4d3611 100644 --- a/tasmota/xsns_47_max31865.ino +++ b/tasmota/xsns_47_max31865.ino @@ -125,10 +125,7 @@ bool Xsns47(uint8_t function) { bool result = false; - if (PinUsed(GPIO_SSPI_MISO) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK) && - (PinUsed(GPIO_SSPI_MAX31865_CS1) || PinUsed(GPIO_SSPI_MAX31865_CS1, 1) || PinUsed(GPIO_SSPI_MAX31865_CS1, 2) || - PinUsed(GPIO_SSPI_MAX31865_CS1, 3) || PinUsed(GPIO_SSPI_MAX31865_CS1, 4) || PinUsed(GPIO_SSPI_MAX31865_CS1, 5))) { - + if (PinUsed(GPIO_SSPI_MAX31865_CS1, GPIO_ANY) && PinUsed(GPIO_SSPI_MISO) && PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_SCLK)) { switch (function) { case FUNC_INIT: MAX31865_Init();