diff --git a/tasmota/support.ino b/tasmota/support.ino index cdd1b3cd6..427a47dcf 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -1265,11 +1265,7 @@ uint32_t ValidPin(uint32_t pin, uint32_t gpio) bool ValidGPIO(uint32_t pin, uint32_t gpio) { -#ifdef ESP8266 - return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins -#else // ESP32 - return (GPIO_USER == ValidPin(pin, gpio >> 5)); // Only allow GPIO_USER pins -#endif // ESP8266 - ESP32 + return (GPIO_USER == ValidPin(pin, BGPIO(gpio))); // Only allow GPIO_USER pins } #ifdef ESP8266 diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 612f4dbce..9c4c858cc 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -1113,10 +1113,8 @@ void CmndGpio(void) } } char sindex[4] = { 0 }; -#ifdef ESP8266 - uint32_t sensor_name_idx = sensor_type; -#else // ESP32 - uint32_t sensor_name_idx = sensor_type >> 5; + uint32_t sensor_name_idx = BGPIO(sensor_type); +#ifdef ESP32 uint32_t nice_list_search = sensor_type & 0xFFE0; for (uint32_t j = 0; j < ARRAY_SIZE(kGpioNiceList); j++) { uint32_t nls_idx = pgm_read_word(kGpioNiceList + j); @@ -1125,7 +1123,7 @@ void CmndGpio(void) break; } } -#endif // ESP8266 - ESP32 +#endif // ESP32 const char *sensor_names = kSensorNames; if (sensor_name_idx > GPIO_FIX_START) { sensor_name_idx = sensor_name_idx - GPIO_FIX_START -1; @@ -1156,7 +1154,7 @@ void CmndGpios(void) uint32_t ridx = midx; #else // ESP32 uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0; - uint32_t midx = ridx >> 5; + uint32_t midx = BGPIO(ridx); #endif // ESP8266 - ESP32 if ((XdrvMailbox.payload != 255) && GetUsedInModule(midx, cmodule.io)) { continue; } if (!jsflg) { diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index d18368431..b5e5c9571 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -1728,7 +1728,7 @@ void HandleTemplateConfiguration(void) WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, AGPIO(GPIO_USER), D_SENSOR_USER); // }2'255'>User}3 } uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0; - uint32_t midx = ridx >> 5; + uint32_t midx = BGPIO(ridx); WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames)); #endif // ESP8266 - ESP32 } @@ -1905,7 +1905,7 @@ void HandleModuleConfiguration(void) } #else // ESP32 uint32_t ridx = pgm_read_word(kGpioNiceList + i) & 0xFFE0; - midx = ridx >> 5; + midx = BGPIO(ridx); if (!GetUsedInModule(midx, cmodule.io)) { WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE_NO_INDEX, ridx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames)); }