diff -r 14231379bec2 -r e32e83550963 thermferm/thermferm.c --- a/thermferm/thermferm.c Tue Sep 15 15:37:39 2015 +0200 +++ b/thermferm/thermferm.c Tue Sep 15 17:26:26 2015 +0200 @@ -277,30 +277,6 @@ -int read_sensor(char *address, int *val) -{ - devices_list *device; - int tmp; - - for (device = Config.devices; device; device = device->next) { - if (strcmp(address, device->uuid) == 0) { -#ifdef HAVE_WIRINGPI_H - piLock(LOCK_DEVICES); -#endif - tmp = device->value + device->offset; -#ifdef HAVE_WIRINGPI_H - piUnlock(LOCK_DEVICES); -#endif - *val = tmp; - return device->present; - } - } - - return DEVPRESENT_NO; -} - - - /* * Handle panel key events */ @@ -1003,7 +979,7 @@ #endif if (Config.temp_address) { - rc = read_sensor(Config.temp_address, &temp); + rc = device_in(Config.temp_address, &temp); if (rc == DEVPRESENT_YES) { Config.temp_value = temp; Config.temp_state = 0; @@ -1020,7 +996,7 @@ } if (Config.hum_address) { - rc = read_sensor(Config.hum_address, &temp); + rc = device_in(Config.hum_address, &temp); if (rc == DEVPRESENT_YES) { Config.hum_value = temp; Config.hum_state = 0; @@ -1045,7 +1021,7 @@ #endif if (unit->air_address) { - rc = read_sensor(unit->air_address, &temp); + rc = device_in(unit->air_address, &temp); if (rc == DEVPRESENT_YES) { /* * It is possible to have read errors or extreme values. @@ -1079,7 +1055,7 @@ } if (unit->beer_address) { - rc = read_sensor(unit->beer_address, &temp); + rc = device_in(unit->beer_address, &temp); if (rc == DEVPRESENT_YES) { deviation = 40000; if ((unit->beer_temperature == 0) || @@ -1105,7 +1081,7 @@ } if (unit->door_address) { - rc = read_sensor(unit->door_address, &temp); + rc = device_in(unit->door_address, &temp); if (rc == DEVPRESENT_YES) { if (temp) { if (unit->door_state == 0) { @@ -1129,7 +1105,7 @@ } if (unit->psu_address) { - rc = read_sensor(unit->psu_address, &temp); + rc = device_in(unit->psu_address, &temp); if (rc == DEVPRESENT_YES) { if (temp) { if (unit->psu_state == 0) {