# HG changeset patch # User Michiel Broek # Date 1556390846 -7200 # Node ID 9795a16de8070fb3475e5e6340cca167b6c47101 # Parent ba340e00aab24ec19e83ff293a4f706e8978bd17 Attempt to better check the temperature sensors and lower the cpu load. diff -r ba340e00aab2 -r 9795a16de807 thermferm/devices.c --- a/thermferm/devices.c Sat Apr 27 15:36:16 2019 +0200 +++ b/thermferm/devices.c Sat Apr 27 20:47:26 2019 +0200 @@ -386,9 +386,9 @@ piUnlock(LOCK_DEVICES); #endif return 0; - } - } - } + } // if ((test_value != my_value) || (((int)now - (int)my_timestamp) >= 120)) + } // if (! strcmp(uuid, device->uuid)) + } // for (device = Config.devices; device; device = device->next) #ifdef HAVE_WIRINGPI_H piUnlock(LOCK_DEVICES); #endif @@ -729,8 +729,8 @@ syslog(LOG_NOTICE, "Thread my_devices_loop started"); #ifdef HAVE_WIRINGPI_H - if ((rc = piHiPri(10))) - syslog(LOG_NOTICE, "my_devices_loop: piHiPri(10) rc=%d", rc); + if ((rc = piHiPri(50))) + syslog(LOG_NOTICE, "my_devices_loop: piHiPri(50) rc=%d", rc); #endif /* @@ -798,6 +798,12 @@ piUnlock(LOCK_DEVICES); #endif } + if ((temp == 85000) || (temp < -125000)) { + syslog(LOG_NOTICE, "sensor %s value error '%d`", device->address, temp); + } + if (temp & 0xf800) { + syslog(LOG_NOTICE, "sensor %s sign bits error", device->address); + } } else { syslog(LOG_NOTICE, "sensor %s CRC error '%s`", device->address, line1); #ifdef HAVE_WIRINGPI_H diff -r ba340e00aab2 -r 9795a16de807 thermferm/server.c --- a/thermferm/server.c Sat Apr 27 15:36:16 2019 +0200 +++ b/thermferm/server.c Sat Apr 27 20:47:26 2019 +0200 @@ -2562,7 +2562,7 @@ fprintf(stdout, "Thread my_server_loop stopped\n"); return 0; } - + usleep(100000); } } diff -r ba340e00aab2 -r 9795a16de807 thermferm/thermferm.c --- a/thermferm/thermferm.c Sat Apr 27 15:36:16 2019 +0200 +++ b/thermferm/thermferm.c Sat Apr 27 20:47:26 2019 +0200 @@ -1230,6 +1230,7 @@ } else { Config.temp_state = 2; } + usleep(10000); } row++; @@ -1260,6 +1261,7 @@ } else { Config.hum_state = 2; } + usleep(10000); } row++; /*