Correct AM2302 temp

This commit is contained in:
2023-12-31 12:52:59 +03:00
parent 84f7313123
commit af4b7e9f6d
3 changed files with 8 additions and 6 deletions

View File

@@ -102,7 +102,7 @@ void setup() {
delay(dht.getMinimumSamplingPeriod());
sTaH = dht.getTempAndHumidity();
if(dht.getStatus() == dht.ERROR_NONE){
temp_out = sTaH.temperature;
temp_out = sTaH.temperature - 2.0;
hum_out = sTaH.humidity;
}
// if (! aht.begin()) {
@@ -132,6 +132,7 @@ void loop() {
static byte bSecs = 0;
char v[10];
static unsigned long ledTime = 0;
float fTemp;
ArduinoOTA.handle();
if(!client.connected()) reconnect();
@@ -153,12 +154,13 @@ void loop() {
Serial.println(bSecs);
sTaH = dht.getTempAndHumidity();
if(dht.getStatus() == dht.ERROR_NONE){
temp_out += (sTaH.temperature - temp_out) / 150.0;
fTemp = sTaH.temperature - 2.0;
temp_out += (fTemp - temp_out) / 150.0;
hum_out += (sTaH.humidity - hum_out) / 150.0;
WebSerial.print("Temp: ");
WebSerial.print(sTaH.temperature);
WebSerial.print(fTemp);
WebSerial.print(", Hum: ");
WebSerial.println(sTaH.temperature);
WebSerial.println(sTaH.humidity);
if(bSecs == 29){
bSecs = 0;
digitalWrite(LED_WRK, LOW);