diff -r 78fb6f99e473 -r 8d2ba4126519 thermferm/thermferm.c --- a/thermferm/thermferm.c Sun Aug 10 14:45:11 2014 +0200 +++ b/thermferm/thermferm.c Sun Aug 10 16:17:03 2014 +0200 @@ -103,7 +103,7 @@ -int read_w1_28(char *address, int *val) +int read_sensor(char *address, int *val) { devices_list *device; int tmp; @@ -364,6 +364,36 @@ lcd_buf_write(row++, " %02d:%02d:%02d ", tm->tm_hour, tm->tm_min, tm->tm_sec); #endif + if (Config.temp_address) { + rc = read_sensor(Config.temp_address, &temp); + if (rc == DEVPRESENT_YES) { + Config.temp_value = temp; + Config.temp_state = 0; +#ifdef HAVE_WIRINGPI_H + lcd_buf_write(row++, "Room temp %.1f %cC ", Config.temp_value / 1000.0, 0xdf); +#endif + } else if (rc == DEVPRESENT_ERROR) { + Config.temp_state = 1; + } else { + Config.temp_state = 2; + } + } + + if (Config.hum_address) { + rc = read_sensor(Config.hum_address, &temp); + if (rc == DEVPRESENT_YES) { + Config.hum_value = temp; + Config.hum_state = 0; +#ifdef HAVE_WIRINGPI_H + lcd_buf_write(row++, " Humidity %.1f %% ", Config.hum_value / 1000.0, 0xdf); +#endif + } else if (rc == DEVPRESENT_ERROR) { + Config.hum_state = 1; + } else { + Config.hum_state = 2; + } + } + for (unit = Config.units; unit; unit = unit->next) { #ifdef HAVE_WIRINGPI_H lcd_buf_write(row++, "Unit %s ", unit->name); @@ -371,7 +401,7 @@ #endif if (unit->air_address) { - rc = read_w1_28(unit->air_address, &temp); + rc = read_sensor(unit->air_address, &temp); if (rc == DEVPRESENT_YES) { /* * It is possible to have read errors or extreme values. @@ -403,7 +433,7 @@ } if (unit->beer_address) { - rc = read_w1_28(unit->beer_address, &temp); + rc = read_sensor(unit->beer_address, &temp); if (rc == DEVPRESENT_YES) { deviation = 40000; if ((unit->beer_temperature == 0) ||