More relaxed DHT11 readings

Sat, 27 Apr 2019 21:07:00 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 27 Apr 2019 21:07:00 +0200
changeset 585
326cf2982eee
parent 584
ff7f038fae2f
child 586
504463dad07d

More relaxed DHT11 readings

thermferm/devices.c file | annotate | diff | comparison | revisions
--- a/thermferm/devices.c	Sat Apr 27 20:54:20 2019 +0200
+++ b/thermferm/devices.c	Sat Apr 27 21:07:00 2019 +0200
@@ -905,13 +905,14 @@
 		case DEVTYPE_DHT:
 			/*
 			 * Make sure we don't read the sensor within 2 seconds.
+			 * But we use 20 seconds interval.
 			 */
 			now = time(NULL);
-			if ((int)(now - dht11_last) > 2) {
+			if ((int)(now - dht11_last) > 20) {
 			    dht11_pin = device->gpiopin;
 			    dht11Read();
 			    dht11_last = now;
-			}
+		//	}
 			if (device->subdevice == 0) {
 			    piLock(LOCK_DEVICES);
 			    if (dht11_valid) {
@@ -933,6 +934,7 @@
 			    }
 			    piUnlock(LOCK_DEVICES);
 			}
+			}
 			break;
 
 		case DEVTYPE_GPIO:

mercurial