122 /* |
122 /* |
123 * If there is no sensor, j = 0 |
123 * If there is no sensor, j = 0 |
124 */ |
124 */ |
125 if ((counter == 255) && (j == 0)) { |
125 if ((counter == 255) && (j == 0)) { |
126 if (dht11_temperature != -1) { |
126 if (dht11_temperature != -1) { |
127 syslog(LOG_WARNING, "dht11 sensor disappeared"); |
127 syslog(LOG_NOTICE, "dht11 sensor disappeared"); |
128 } else { |
128 } else { |
129 syslog(LOG_WARNING, "dht11 sensor not present"); |
129 syslog(LOG_NOTICE, "dht11 sensor not present"); |
130 } |
130 } |
131 dht11_temperature = -1; |
131 dht11_temperature = -1; |
132 dht11_humidity = -1; |
132 dht11_humidity = -1; |
133 dht11_valid = FALSE; |
133 dht11_valid = FALSE; |
134 return; |
134 return; |
511 addr = xstrcpy((char *)"/sys/bus/w1/devices/"); |
511 addr = xstrcpy((char *)"/sys/bus/w1/devices/"); |
512 addr = xstrcat(addr, device->address); |
512 addr = xstrcat(addr, device->address); |
513 addr = xstrcat(addr, (char *)"/w1_slave"); |
513 addr = xstrcat(addr, (char *)"/w1_slave"); |
514 if ((fp = fopen(addr, "r"))) { |
514 if ((fp = fopen(addr, "r"))) { |
515 if (device->present != DEVPRESENT_YES) { |
515 if (device->present != DEVPRESENT_YES) { |
516 syslog(LOG_WARNING, "sensor %s is back", device->address); |
516 syslog(LOG_NOTICE, "sensor %s is back", device->address); |
517 #ifdef HAVE_WIRINGPI_H |
517 #ifdef HAVE_WIRINGPI_H |
518 piLock(LOCK_DEVICES); |
518 piLock(LOCK_DEVICES); |
519 #endif |
519 #endif |
520 device->present = DEVPRESENT_YES; |
520 device->present = DEVPRESENT_YES; |
521 #ifdef HAVE_WIRINGPI_H |
521 #ifdef HAVE_WIRINGPI_H |
545 } |
545 } |
546 #ifdef HAVE_WIRINGPI_H |
546 #ifdef HAVE_WIRINGPI_H |
547 piUnlock(LOCK_DEVICES); |
547 piUnlock(LOCK_DEVICES); |
548 #endif |
548 #endif |
549 } else { |
549 } else { |
550 syslog(LOG_WARNING, "sensor %s CRC error", device->address); |
550 syslog(LOG_NOTICE, "sensor %s CRC error", device->address); |
551 #ifdef HAVE_WIRINGPI_H |
551 #ifdef HAVE_WIRINGPI_H |
552 piLock(LOCK_DEVICES); |
552 piLock(LOCK_DEVICES); |
553 #endif |
553 #endif |
554 device->present = DEVPRESENT_ERROR; |
554 device->present = DEVPRESENT_ERROR; |
555 #ifdef HAVE_WIRINGPI_H |
555 #ifdef HAVE_WIRINGPI_H |
557 #endif |
557 #endif |
558 } |
558 } |
559 fclose(fp); |
559 fclose(fp); |
560 } else { |
560 } else { |
561 if (device->present != DEVPRESENT_NO) { |
561 if (device->present != DEVPRESENT_NO) { |
562 syslog(LOG_WARNING, "sensor %s is missing", device->address); |
562 syslog(LOG_NOTICE, "sensor %s is missing", device->address); |
563 #ifdef HAVE_WIRINGPI_H |
563 #ifdef HAVE_WIRINGPI_H |
564 piLock(LOCK_DEVICES); |
564 piLock(LOCK_DEVICES); |
565 #endif |
565 #endif |
566 device->present = DEVPRESENT_NO; |
566 device->present = DEVPRESENT_NO; |
567 #ifdef HAVE_WIRINGPI_H |
567 #ifdef HAVE_WIRINGPI_H |