diff --git a/tasmota/support.ino b/tasmota/support.ino index 37bdb942a..490918276 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -635,7 +635,6 @@ float CalcTempHumToDew(float t, float h) t = (t - 32) / 1.8; // Celsius } -// float gamma = log(h / 100) + 17.62 * t / (243.5 + t); float gamma = TaylorLog(h / 100) + 17.62 * t / (243.5 + t); float result = (243.5 * gamma / (17.62 - gamma)); diff --git a/tasmota/xsns_07_sht1x.ino b/tasmota/xsns_07_sht1x.ino index 3193f71ed..735802ca2 100644 --- a/tasmota/xsns_07_sht1x.ino +++ b/tasmota/xsns_07_sht1x.ino @@ -149,7 +149,7 @@ bool ShtRead(void) float rhLinear = c1 + c2 * humRaw + c3 * humRaw * humRaw; sht_humidity = (sht_temperature - 25) * (t1 + t2 * humRaw) + rhLinear; sht_temperature = ConvertTemp(sht_temperature); - ConvertHumidity(sht_humidity); // Set global humidity + sht_humidity = ConvertHumidity(sht_humidity); sht_valid = SENSOR_MAX_MISS; return true; diff --git a/tasmota/xsns_08_htu21.ino b/tasmota/xsns_08_htu21.ino index 14bfcaa50..e0cab5d1c 100644 --- a/tasmota/xsns_08_htu21.ino +++ b/tasmota/xsns_08_htu21.ino @@ -187,7 +187,7 @@ bool HtuRead(void) if ((htu_temperature > 0.00) && (htu_temperature < 80.00)) { htu_humidity = (-0.15) * (25 - htu_temperature) + htu_humidity; } - ConvertHumidity(htu_humidity); // Set global humidity + htu_humidity = ConvertHumidity(htu_humidity); htu_valid = SENSOR_MAX_MISS; return true; diff --git a/tasmota/xsns_09_bmp.ino b/tasmota/xsns_09_bmp.ino index 7af6dc0b7..9e3ee59b4 100644 --- a/tasmota/xsns_09_bmp.ino +++ b/tasmota/xsns_09_bmp.ino @@ -511,8 +511,6 @@ void BmpRead(void) #endif // USE_BME680 } } - ConvertTemp(bmp_sensors[0].bmp_temperature); // Set global temperature - ConvertHumidity(bmp_sensors[0].bmp_humidity); // Set global humidity } void BmpShow(bool json) @@ -539,9 +537,11 @@ void BmpShow(bool json) dtostrfd(bmp_pressure, Settings.flag2.pressure_resolution, pressure); char sea_pressure[33]; dtostrfd(bmp_sealevel, Settings.flag2.pressure_resolution, sea_pressure); + + float bmp_humidity = ConvertHumidity(bmp_sensors[bmp_idx].bmp_humidity); char humidity[33]; - dtostrfd(bmp_sensors[bmp_idx].bmp_humidity, Settings.flag2.humidity_resolution, humidity); - float f_dewpoint = CalcTempHumToDew(bmp_temperature, bmp_sensors[bmp_idx].bmp_humidity); + dtostrfd(bmp_humidity, Settings.flag2.humidity_resolution, humidity); + float f_dewpoint = CalcTempHumToDew(bmp_temperature, bmp_humidity); char dewpoint[33]; dtostrfd(f_dewpoint, Settings.flag2.temperature_resolution, dewpoint); #ifdef USE_BME680 @@ -572,7 +572,7 @@ void BmpShow(bool json) #ifdef USE_DOMOTICZ if ((0 == tele_period) && (0 == bmp_idx)) { // We want the same first sensor to report to Domoticz in case a read is missed - DomoticzTempHumPressureSensor(bmp_temperature, bmp_sensors[bmp_idx].bmp_humidity, bmp_pressure); + DomoticzTempHumPressureSensor(bmp_temperature, bmp_humidity, bmp_pressure); #ifdef USE_BME680 if (bmp_sensors[bmp_idx].bmp_model >= 3) { DomoticzSensor(DZ_AIRQUALITY, (uint32_t)bmp_sensors[bmp_idx].bmp_gas_resistance); } #endif // USE_BME680 @@ -582,7 +582,7 @@ void BmpShow(bool json) #ifdef USE_KNX if (0 == tele_period) { KnxSensor(KNX_TEMPERATURE, bmp_temperature); - KnxSensor(KNX_HUMIDITY, bmp_sensors[bmp_idx].bmp_humidity); + KnxSensor(KNX_HUMIDITY, bmp_humidity); } #endif // USE_KNX diff --git a/tasmota/xsns_14_sht3x.ino b/tasmota/xsns_14_sht3x.ino index 4037f298a..ca3bcf78e 100644 --- a/tasmota/xsns_14_sht3x.ino +++ b/tasmota/xsns_14_sht3x.ino @@ -71,7 +71,7 @@ bool Sht3xRead(float &t, float &h, uint8_t sht3x_address) data[i] = Wire.read(); // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc }; t = ConvertTemp((float)((((data[0] << 8) | data[1]) * 175) / 65535.0) - 45); - h = ConvertHumidity((float)((((data[3] << 8) | data[4]) * 100) / 65535.0)); // Set global humidity + h = ConvertHumidity((float)((((data[3] << 8) | data[4]) * 100) / 65535.0)); return (!isnan(t) && !isnan(h) && (h != 0)); } diff --git a/tasmota/xsns_63_aht1x.ino b/tasmota/xsns_63_aht1x.ino index 97b16ff05..71892086a 100644 --- a/tasmota/xsns_63_aht1x.ino +++ b/tasmota/xsns_63_aht1x.ino @@ -105,10 +105,7 @@ void AHT1XPoll(void) // We have 100ms for read. Sensor needs 80-95 ms AHT1XWrite(0); break; case 11: - if (AHT1XRead(0)){ - ConvertTemp(aht1x_sensors[0].temperature); // Set global temperature - ConvertHumidity(aht1x_sensors[0].humidity); // Set global humidity - } + AHT1XRead(0); aht1x_Pcount = 0; break; } diff --git a/tasmota/xsns_65_hdc1080.ino b/tasmota/xsns_65_hdc1080.ino index 86e82e7df..6e834ef90 100644 --- a/tasmota/xsns_65_hdc1080.ino +++ b/tasmota/xsns_65_hdc1080.ino @@ -223,8 +223,7 @@ bool HdcRead(void) { if (hdc_humidity > 100) { hdc_humidity = 100.0; } if (hdc_humidity < 0) { hdc_humidity = 0.01; } - - ConvertHumidity(hdc_humidity); // Set global humidity + hdc_humidity = ConvertHumidity(hdc_humidity); hdc_valid = SENSOR_MAX_MISS;