thermferm/devices.c

changeset 362
c92651a54969
parent 354
5ff387f4d6b7
child 392
034746506c3d
equal deleted inserted replaced
361:308f6a436779 362:c92651a54969
29 29
30 extern int debug; 30 extern int debug;
31 extern sys_config Config; 31 extern sys_config Config;
32 extern int my_shutdown; 32 extern int my_shutdown;
33 33
34 #ifdef USE_SIMULATOR
35
36 extern int SIMcooling;
37 extern int SIMheating;
38
39 #endif
34 40
35 #ifdef HAVE_WIRINGPI_H 41 #ifdef HAVE_WIRINGPI_H
36 42
37 #define MAXTIMINGS 100 43 #define MAXTIMINGS 100
38 44
349 } 355 }
350 } 356 }
351 357
352 #ifdef USE_SIMULATOR 358 #ifdef USE_SIMULATOR
353 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) { 359 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) {
354 360 if ((strcmp((char *)"SimCooler", device->address) == 0) || (strcmp((char *)"SimHeater", device->address) == 0)) {
361 if (value != device->value) {
362 syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value);
363 if (debug)
364 fprintf(stdout, "SIM %s value=%d\n", device->address, value);
365 }
366 device->value = value;
367 device->timestamp = time(NULL);
368 if (strcmp((char *)"SimCooler", device->address) == 0)
369 SIMcooling = value;
370 if (strcmp((char *)"SimHeater", device->address) == 0)
371 SIMheating = value;
372 }
355 } 373 }
356 #endif 374 #endif
357 } else { 375 } else {
358 #ifdef HAVE_WIRINGPI_H 376 #ifdef HAVE_WIRINGPI_H
359 piUnlock(LOCK_DEVICES); 377 piUnlock(LOCK_DEVICES);

mercurial