903 |
903 |
904 #ifdef HAVE_WIRINGPI_H |
904 #ifdef HAVE_WIRINGPI_H |
905 case DEVTYPE_DHT: |
905 case DEVTYPE_DHT: |
906 /* |
906 /* |
907 * Make sure we don't read the sensor within 2 seconds. |
907 * Make sure we don't read the sensor within 2 seconds. |
|
908 * But we use 20 seconds interval. |
908 */ |
909 */ |
909 now = time(NULL); |
910 now = time(NULL); |
910 if ((int)(now - dht11_last) > 2) { |
911 if ((int)(now - dht11_last) > 20) { |
911 dht11_pin = device->gpiopin; |
912 dht11_pin = device->gpiopin; |
912 dht11Read(); |
913 dht11Read(); |
913 dht11_last = now; |
914 dht11_last = now; |
914 } |
915 // } |
915 if (device->subdevice == 0) { |
916 if (device->subdevice == 0) { |
916 piLock(LOCK_DEVICES); |
917 piLock(LOCK_DEVICES); |
917 if (dht11_valid) { |
918 if (dht11_valid) { |
918 device->value = dht11_temperature * 1000; |
919 device->value = dht11_temperature * 1000; |
919 device->timestamp = time(NULL); |
920 device->timestamp = time(NULL); |