Added heat/cool state to the LCD display

Tue, 05 Aug 2014 22:50:33 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 05 Aug 2014 22:50:33 +0200
changeset 188
4fc17ef4593f
parent 187
3c8bf18fdf42
child 189
cc2b04d4db99

Added heat/cool state to the LCD display

thermferm/thermferm.c file | annotate | diff | comparison | revisions
--- a/thermferm/thermferm.c	Tue Aug 05 22:29:22 2014 +0200
+++ b/thermferm/thermferm.c	Tue Aug 05 22:50:33 2014 +0200
@@ -354,12 +354,6 @@
 #ifdef HAVE_WIRINGPI_H
 		lcd_buf_write(row++, "Unit %s              ", unit->name);
 		lcd_buf_write(row++, "Mode %s              ", UNITMODE[unit->mode]);
-		if (unit->air_address) {
-		    lcd_buf_write(row++, " Air %.3f %cC         ", unit->air_temperature / 1000.0, 0xdf);
-		}
-		if (unit->beer_address) {
-		    lcd_buf_write(row++, "Beer %.3f %cC         ", unit->beer_temperature / 1000.0, 0xdf);
-		}
 #endif
 
 		if (unit->air_address) {
@@ -378,6 +372,9 @@
 			    (unit->air_temperature && (temp > (int)unit->air_temperature - deviation) && (temp < ((int)unit->air_temperature + deviation)))) {
 			    unit->air_temperature = temp;
 			    unit->air_state = 0;
+#ifdef HAVE_WIRINGPI_H
+			    lcd_buf_write(row++, " Air %.3f %cC         ", unit->air_temperature / 1000.0, 0xdf);
+#endif
 			} else {
 			    syslog(LOG_NOTICE, "deviation error deviation=%d, old=%d new=%d", deviation, unit->air_temperature, temp);
 			    if (debug) {
@@ -399,6 +396,9 @@
 			    (unit->beer_temperature && (temp > (int)unit->beer_temperature - deviation) && (temp < ((int)unit->beer_temperature + deviation)))) {
 			    unit->beer_temperature = temp;
 			    unit->beer_state = 0;
+#ifdef HAVE_WIRINGPI_H
+			    lcd_buf_write(row++, "Beer %.3f %cC         ", unit->beer_temperature / 1000.0, 0xdf);
+#endif
 			} else {
 			    syslog(LOG_NOTICE, "deviation error deviation=%d, old=%d new=%d", deviation, unit->beer_temperature, temp);
 			    if (debug) {
@@ -420,6 +420,14 @@
 		    device_out(unit->cooler_address, unit->cooler_state);
 		    device_out(unit->fan_address, unit->fan_state);
 		}
+#ifdef HAVE_WIRINGPI_H
+		if (unit->heater_address) {
+		    lcd_buf_write(row++, "Heater %s          ", unit->heater_state ? "On ":"Off");
+		}
+		if (unit->cooler_address) {
+		    lcd_buf_write(row++, "Cooler %s          ", unit->cooler_state ? "On ":"Off");
+		}
+#endif
 	    }
 
 #ifdef HAVE_WIRINGPI_H

mercurial