# HG changeset patch # User Michiel Broek # Date 1407232625 -7200 # Node ID 4099412fca0919e962d62bdb6d8e03267ac4f65b # Parent b62644eb442f6fad130b9394c98aa3a71c86bbf2 Fixed double commands to 433 MHz switches, they did not switch. diff -r b62644eb442f -r 4099412fca09 thermferm/devices.c --- a/thermferm/devices.c Mon Aug 04 23:36:05 2014 +0200 +++ b/thermferm/devices.c Tue Aug 05 11:57:05 2014 +0200 @@ -42,6 +42,9 @@ if (uuid == NULL) return 0; + if (debug) + fprintf(stdout, "device_out(%s, %d)\n", uuid, value); + for (device = Config.devices; device; device = device->next) { if (strcmp(uuid, device->uuid) == 0) { if (value != device->value) { diff -r b62644eb442f -r 4099412fca09 thermferm/units.c --- a/thermferm/units.c Mon Aug 04 23:36:05 2014 +0200 +++ b/thermferm/units.c Tue Aug 05 11:57:05 2014 +0200 @@ -21,6 +21,7 @@ *****************************************************************************/ #include "thermferm.h" +#include "devices.h" #include "units.h" #include "xutil.h" @@ -58,7 +59,6 @@ #endif { units_list *unit; - devices_list *device; int rc, temp, deviation; /* @@ -156,17 +156,8 @@ if (my_shutdown) break; - device_out(unit->heater_address, unit->heater_state); - if (my_shutdown) - break; - device_out(unit->cooler_address, unit->cooler_state); - if (my_shutdown) - break; - device_out(unit->fan_address, unit->fan_state); - if (my_shutdown) - break; } - usleep(10000); + usleep(100000); } /* @@ -177,6 +168,9 @@ * Turn everything off */ unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = 0; + device_out(unit->heater_address, unit->heater_state); + device_out(unit->cooler_address, unit->cooler_state); + device_out(unit->fan_address, unit->fan_state); syslog(LOG_NOTICE, "Stopped unit %s mode %s", unit->name, UNITMODE[unit->mode]); }