Browse Source

fix minchange abs

master
interfisch 2 years ago
parent
commit
4de344ca57
  1. 6
      src/main.cpp

6
src/main.cpp

@ -156,7 +156,7 @@ void loop_DHT22_temperature() @@ -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() @@ -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() @@ -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();

Loading…
Cancel
Save