thermferm/devices.c

changeset 589
230a502b75ec
parent 588
322a29000fd7
child 591
95cf33f8021f
equal deleted inserted replaced
588:322a29000fd7 589:230a502b75ec
814 rc = sscanf(p, "%d", &temp); 814 rc = sscanf(p, "%d", &temp);
815 if ((rc == 1) && (device->value != temp)) { 815 if ((rc == 1) && (device->value != temp)) {
816 #ifdef HAVE_WIRINGPI_H 816 #ifdef HAVE_WIRINGPI_H
817 piLock(LOCK_DEVICES); 817 piLock(LOCK_DEVICES);
818 #endif 818 #endif
819 if (temp < -125000) { 819 if (temp < -55000) {
820 syslog(LOG_NOTICE, "sensor %s value error '%d`", device->address, temp); 820 syslog(LOG_NOTICE, "sensor %s value error '%d` '%s`", device->address, temp, line1);
821 syslog(LOG_NOTICE, " %s", line1);
822 device->present = DEVPRESENT_ERROR; 821 device->present = DEVPRESENT_ERROR;
823 } else { 822 } else {
824 device->value = temp; 823 device->value = temp;
825 device->timestamp = time(NULL); 824 device->timestamp = time(NULL);
826 device->present = DEVPRESENT_YES; 825 device->present = DEVPRESENT_YES;
827 } 826 }
828 #ifdef HAVE_WIRINGPI_H 827 #ifdef HAVE_WIRINGPI_H
829 piUnlock(LOCK_DEVICES); 828 piUnlock(LOCK_DEVICES);
830 #endif 829 #endif
831 }
832 if (temp == 85000) {
833 syslog(LOG_NOTICE, "sensor %s value error '%d`", device->address, temp);
834 } 830 }
835 } else { 831 } else {
836 syslog(LOG_NOTICE, "sensor %s CRC error '%s`", device->address, line1); 832 syslog(LOG_NOTICE, "sensor %s CRC error '%s`", device->address, line1);
837 #ifdef HAVE_WIRINGPI_H 833 #ifdef HAVE_WIRINGPI_H
838 piLock(LOCK_DEVICES); 834 piLock(LOCK_DEVICES);

mercurial