diff --git a/tasmota/tasmota_globals.h b/tasmota/tasmota_globals.h index f52f7a218..791896ac3 100644 --- a/tasmota/tasmota_globals.h +++ b/tasmota/tasmota_globals.h @@ -372,8 +372,10 @@ const char kWebColors[] PROGMEM = #ifdef ESP8266 #define AGPIO(x) (x) +#define BGPIO(x) (x) #else // ESP32 #define AGPIO(x) (x<<5) +#define BGPIO(x) (x>>5) #endif // ESP8266 - ESP32 #ifdef USE_DEVICE_GROUPS diff --git a/tasmota/xsns_06_dht.ino b/tasmota/xsns_06_dht.ino index 7bb1a3513..d2e47fe17 100644 --- a/tasmota/xsns_06_dht.ino +++ b/tasmota/xsns_06_dht.ino @@ -188,12 +188,12 @@ bool DhtRead(uint32_t sensor) bool DhtPinState() { - if ((XdrvMailbox.index >= GPIO_DHT11) && (XdrvMailbox.index <= GPIO_SI7021)) { + if ((XdrvMailbox.index >= AGPIO(GPIO_DHT11)) && (XdrvMailbox.index <= AGPIO(GPIO_SI7021))) { if (dht_sensors < DHT_MAX_SENSORS) { Dht[dht_sensors].pin = XdrvMailbox.payload; - Dht[dht_sensors].type = XdrvMailbox.index; + Dht[dht_sensors].type = BGPIO(XdrvMailbox.index); dht_sensors++; - XdrvMailbox.index = GPIO_DHT11; + XdrvMailbox.index = AGPIO(GPIO_DHT11); } else { XdrvMailbox.index = 0; }