thermferm/devices.c

changeset 596
e3d3cde32847
parent 591
95cf33f8021f
child 643
586d376ab629
equal deleted inserted replaced
595:d7342a8e7f4d 596:e3d3cde32847
25 #include "rc-switch.h" 25 #include "rc-switch.h"
26 #include "panel.h" 26 #include "panel.h"
27 #include "xutil.h" 27 #include "xutil.h"
28 28
29 29
30 extern int debug;
31 extern sys_config Config; 30 extern sys_config Config;
32 extern int my_shutdown; 31 extern int my_shutdown;
33 32
34 #ifdef USE_SIMULATOR 33 #ifdef USE_SIMULATOR
35 34
311 enableTransmit(device->gpiopin); 310 enableTransmit(device->gpiopin);
312 rc = toggleSwitch(buf); 311 rc = toggleSwitch(buf);
313 disableTransmit(); 312 disableTransmit();
314 piLock(LOCK_DEVICES); 313 piLock(LOCK_DEVICES);
315 syslog(LOG_NOTICE, "RC433 command %s rc=%d", buf, rc); 314 syslog(LOG_NOTICE, "RC433 command %s rc=%d", buf, rc);
316 if (debug)
317 fprintf(stdout, "RC433 command %s rc=%d\n", buf, rc);
318 device->value = value; 315 device->value = value;
319 device->timestamp = time(NULL); 316 device->timestamp = time(NULL);
320 piUnlock(LOCK_DEVICES); 317 piUnlock(LOCK_DEVICES);
321 return rc; 318 return rc;
322 } 319 }
361 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) { 358 if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) {
362 if ((strcmp((char *)"SimCooler", device->address) == 0) || (strcmp((char *)"SimHeater", device->address) == 0) || 359 if ((strcmp((char *)"SimCooler", device->address) == 0) || (strcmp((char *)"SimHeater", device->address) == 0) ||
363 (strcmp((char *)"SimFan" , device->address) == 0) || (strcmp((char *)"SimLight" , device->address) == 0)) { 360 (strcmp((char *)"SimFan" , device->address) == 0) || (strcmp((char *)"SimLight" , device->address) == 0)) {
364 if (value != device->value) { 361 if (value != device->value) {
365 syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value); 362 syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value);
366 if (debug)
367 fprintf(stdout, "SIM %s value=%d\n", device->address, value);
368 } 363 }
369 device->value = value; 364 device->value = value;
370 device->timestamp = time(NULL); 365 device->timestamp = time(NULL);
371 if (strcmp((char *)"SimCooler", device->address) == 0) 366 if (strcmp((char *)"SimCooler", device->address) == 0)
372 SIMcooling = value; 367 SIMcooling = value;

mercurial