fix minchange abs

This commit is contained in:
interfisch 2020-10-03 12:19:44 +02:00
parent 0edc6dd475
commit 4de344ca57
1 changed files with 3 additions and 3 deletions

View File

@ -156,7 +156,7 @@ void loop_DHT22_temperature()
if (millis() >= (d.lastreadtime+d.readdelay)) {
value_temperatureDHT = dht.readTemperature();
if (abs(d.lastsentvalue-value_temperatureDHT)>=d.minchange){
if (fabs(d.lastsentvalue-value_temperatureDHT)>=d.minchange){
_changed=true;
}
d.lastreadtime=millis();
@ -185,7 +185,7 @@ void loop_DHT22_humidity()
if (millis() >= (d.lastreadtime+d.readdelay)) {
value_humidityDHT = dht.readHumidity();
if (abs(d.lastsentvalue-value_humidityDHT)>=d.minchange){
if (fabs(d.lastsentvalue-value_humidityDHT)>=d.minchange){
_changed=true;
}
d.lastreadtime=millis();
@ -214,7 +214,7 @@ void loop_BH1750()
bool _changed=false;
if (millis() >= (d.lastreadtime+d.readdelay)) {
value_lightBH1750 = lightMeter.readLightLevel(); // [lux]
if (abs(d.lastsentvalue-value_lightBH1750)>=d.minchange){
if (fabs(d.lastsentvalue-value_lightBH1750)>=d.minchange){
_changed=true;
}
d.lastreadtime=millis();