brewco/devices.c

changeset 451
2247970de278
parent 438
7d1ec160d751
child 452
edc86e2d2eaa
equal deleted inserted replaced
450:8fe99759c27f 451:2247970de278
22 22
23 #include "brewco.h" 23 #include "brewco.h"
24 #include "devices.h" 24 #include "devices.h"
25 #include "xutil.h" 25 #include "xutil.h"
26 #include "keyboard.h" 26 #include "keyboard.h"
27 #include "slcd.h"
27 28
28 29
29 extern int debug; 30 extern int debug;
30 extern sys_config Config; 31 extern sys_config Config;
31 extern int my_shutdown; 32 extern int my_shutdown;
32 33
33 #ifdef USE_SIMULATOR 34 #ifdef USE_SIMULATOR
34 35
35 extern int SIM_hlt_value; 36 extern int SIM_hlt_value;
36 extern int SIM_mlt_value; 37 extern int SIM_mlt_value;
38 extern uint16_t leds;
39 extern int slcdHandle;
37 40
38 #endif 41 #endif
39 42
40 43
41 44
205 } 208 }
206 } 209 }
207 210
208 #ifdef USE_SIMULATOR 211 #ifdef USE_SIMULATOR
209 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) { 212 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) {
210 if ((strcmp((char *)"SimHLTheater", device->address) == 0) || (strcmp((char *)"SimMLTheater", device->address) == 0)) { 213 if ((strcmp((char *)"SimHLTheater", device->address) == 0) ||
214 (strcmp((char *)"SimMLTheater", device->address) == 0) ||
215 (strcmp((char *)"SimMLTpump", device->address) == 0)) {
211 if (value != device->value) { 216 if (value != device->value) {
212 syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value); 217 syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value);
213 if (debug) 218 if (debug)
214 fprintf(stdout, "SIM %s value=%d\n", device->address, value); 219 fprintf(stdout, "SIM %s value=%d\n", device->address, value);
215 } 220 }
216 device->value = value; 221 device->value = value;
217 if (strcmp((char *)"SimHLTheater", device->address) == 0) 222 if (strcmp((char *)"SimHLTheater", device->address) == 0) {
218 SIM_hlt_value = value; 223 SIM_hlt_value = value;
219 if (strcmp((char *)"SimMLTheater", device->address) == 0) 224 if (value)
225 leds |= SLED_HLTH;
226 else
227 leds &= ~SLED_HLTH;
228 slcdLEDs(slcdHandle);
229 }
230 if (strcmp((char *)"SimMLTheater", device->address) == 0) {
220 SIM_mlt_value = value; 231 SIM_mlt_value = value;
232 if (value)
233 leds |= SLED_MLTH;
234 else
235 leds &= ~SLED_MLTH;
236 slcdLEDs(slcdHandle);
237 }
238 if (strcmp((char *)"SimMLTpump", device->address) == 0) {
239 if (value)
240 leds |= SLED_MLTP;
241 else
242 leds &= ~SLED_MLTP;
243 slcdLEDs(slcdHandle);
244 }
221 } 245 }
222 } 246 }
223 #endif 247 #endif
224 } else { 248 } else {
225 #ifdef HAVE_WIRINGPI_H 249 #ifdef HAVE_WIRINGPI_H
522 break; 546 break;
523 case 2: ndev->direction = DEVDIR_IN_ANALOG; 547 case 2: ndev->direction = DEVDIR_IN_ANALOG;
524 ndev->address = xstrcpy((char *)"SimMLTtemp"); 548 ndev->address = xstrcpy((char *)"SimMLTtemp");
525 ndev->description = xstrcpy((char *)"Simulated MLT temperature"); 549 ndev->description = xstrcpy((char *)"Simulated MLT temperature");
526 break; 550 break;
527 case 3: ndev->direction = DEVDIR_OUT_ANALOG; 551 case 3: ndev->direction = DEVDIR_OUT_BIN;
528 ndev->address = xstrcpy((char *)"SimHLTheater"); 552 ndev->address = xstrcpy((char *)"SimHLTheater");
529 ndev->description = xstrcpy((char *)"Simulated HLT heater"); 553 ndev->description = xstrcpy((char *)"Simulated HLT heater");
530 break; 554 break;
531 case 4: ndev->direction = DEVDIR_OUT_ANALOG; 555 case 4: ndev->direction = DEVDIR_OUT_BIN;
532 ndev->address = xstrcpy((char *)"SimMLTheater"); 556 ndev->address = xstrcpy((char *)"SimMLTheater");
533 ndev->description = xstrcpy((char *)"Simulated MLT heater"); 557 ndev->description = xstrcpy((char *)"Simulated MLT heater");
534 break; 558 break;
535 case 5: ndev->direction = DEVDIR_OUT_ANALOG; 559 case 5: ndev->direction = DEVDIR_OUT_BIN;
536 ndev->address = xstrcpy((char *)"SimMLTpump"); 560 ndev->address = xstrcpy((char *)"SimMLTpump");
537 ndev->description = xstrcpy((char *)"Simulated MLT pump"); 561 ndev->description = xstrcpy((char *)"Simulated MLT pump");
538 break; 562 break;
539 } 563 }
540 564

mercurial