brewco/devices.c

changeset 451
2247970de278
parent 438
7d1ec160d751
child 452
edc86e2d2eaa
--- a/brewco/devices.c	Sun Dec 06 20:23:31 2015 +0100
+++ b/brewco/devices.c	Thu Dec 10 15:58:01 2015 +0100
@@ -24,6 +24,7 @@
 #include "devices.h"
 #include "xutil.h"
 #include "keyboard.h"
+#include "slcd.h"
 
 
 extern int		debug;
@@ -32,8 +33,10 @@
 
 #ifdef USE_SIMULATOR
 
-extern int	SIM_hlt_value;
-extern int	SIM_mlt_value;
+extern int		SIM_hlt_value;
+extern int		SIM_mlt_value;
+extern uint16_t		leds;
+extern int		slcdHandle;
 
 #endif
 
@@ -207,17 +210,38 @@
 
 #ifdef USE_SIMULATOR
 		if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) {
-		    if ((strcmp((char *)"SimHLTheater", device->address) == 0) || (strcmp((char *)"SimMLTheater", device->address) == 0)) {
+		    if ((strcmp((char *)"SimHLTheater", device->address) == 0) || 
+			(strcmp((char *)"SimMLTheater", device->address) == 0) || 
+		        (strcmp((char *)"SimMLTpump", device->address) == 0)) {
 			if (value != device->value) {
 			    syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value);
 			    if (debug)
 			    	fprintf(stdout, "SIM %s value=%d\n", device->address, value);
 			}
 			device->value = value;
-			if (strcmp((char *)"SimHLTheater", device->address) == 0)
+			if (strcmp((char *)"SimHLTheater", device->address) == 0) {
 			    SIM_hlt_value = value;
-			if (strcmp((char *)"SimMLTheater", device->address) == 0)
+			    if (value)
+				leds |= SLED_HLTH;
+			    else
+				leds &= ~SLED_HLTH;
+			    slcdLEDs(slcdHandle);
+			}
+			if (strcmp((char *)"SimMLTheater", device->address) == 0) {
 			    SIM_mlt_value = value;
+			    if (value)
+				leds |= SLED_MLTH;
+			    else
+				leds &= ~SLED_MLTH;
+			    slcdLEDs(slcdHandle);
+			}
+			if (strcmp((char *)"SimMLTpump", device->address) == 0) {
+			    if (value)
+				leds |= SLED_MLTP;
+			    else
+				leds &= ~SLED_MLTP;
+			    slcdLEDs(slcdHandle);
+			}
 		    }
 		}
 #endif
@@ -524,15 +548,15 @@
 			ndev->address = xstrcpy((char *)"SimMLTtemp");
 			ndev->description = xstrcpy((char *)"Simulated MLT temperature");
 			break;
-		case 3:	ndev->direction = DEVDIR_OUT_ANALOG;
+		case 3:	ndev->direction = DEVDIR_OUT_BIN;
 			ndev->address = xstrcpy((char *)"SimHLTheater");
 			ndev->description = xstrcpy((char *)"Simulated HLT heater");
 			break;
-		case 4:	ndev->direction = DEVDIR_OUT_ANALOG;
+		case 4:	ndev->direction = DEVDIR_OUT_BIN;
 			ndev->address = xstrcpy((char *)"SimMLTheater");
 			ndev->description = xstrcpy((char *)"Simulated MLT heater");
 			break;
-		case 5:	ndev->direction = DEVDIR_OUT_ANALOG;
+		case 5:	ndev->direction = DEVDIR_OUT_BIN;
 			ndev->address = xstrcpy((char *)"SimMLTpump");
 			ndev->description = xstrcpy((char *)"Simulated MLT pump");
 			break;

mercurial