--- a/thermferm/server.c Tue Aug 26 14:45:03 2014 +0200 +++ b/thermferm/server.c Sat Aug 30 13:06:07 2014 +0200 @@ -1350,6 +1350,8 @@ unit->air_temperature = unit->beer_temperature = 20000; unit->beer_set = unit->fridge_set = 20.0; unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; + unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ + unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0; unit->temp_set_min = 1.0; unit->temp_set_max = 30.0; unit->idle_rangeH = 1.0; @@ -1429,10 +1431,13 @@ srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0); srv_send((char *)"HEATER_ADDRESS,%s", unit->heater_address); srv_send((char *)"HEATER_STATE,%d", unit->heater_state); + srv_send((char *)"HEATER_DELAY,%d", unit->heater_delay); srv_send((char *)"COOLER_ADDRESS,%s", unit->cooler_address); srv_send((char *)"COOLER_STATE,%d", unit->cooler_state); + srv_send((char *)"COOLER_DELAY,%d", unit->cooler_delay); srv_send((char *)"FAN_ADDRESS,%s", unit->fan_address); srv_send((char *)"FAN_STATE,%d", unit->fan_state); + srv_send((char *)"FAN_DELAY,%d", unit->fan_delay); srv_send((char *)"DOOR_ADDRESS,%s", unit->door_address); srv_send((char *)"DOOR_STATE,%d", unit->door_state); srv_send((char *)"MODE,%s", UNITMODE[unit->mode]); @@ -1541,6 +1546,10 @@ if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) unit->heater_state = ival; + } else if (val && (strcmp(kwd, (char *)"HEATER_DELAY") == 0)) { + if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) + unit->heater_delay = ival; + } else if (strcmp(kwd, (char *)"COOLER_ADDRESS") == 0) { if (unit->cooler_address) { device_count(FALSE, unit->cooler_address); @@ -1556,6 +1565,10 @@ if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) unit->cooler_state = ival; + } else if (val && (strcmp(kwd, (char *)"COOLER_DELAY") == 0)) { + if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) + unit->cooler_delay = ival; + } else if (strcmp(kwd, (char *)"FAN_ADDRESS") == 0) { if (unit->fan_address) { device_count(FALSE, unit->fan_address); @@ -1571,6 +1584,10 @@ if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) unit->fan_state = ival; + } else if (val && (strcmp(kwd, (char *)"FAN_DELAY") == 0)) { + if ((sscanf(val, "%d", &ival) == 1) && ((ival == 0) || (ival == 100))) + unit->fan_delay = ival; + } else if (strcmp(kwd, (char *)"DOOR_ADDRESS") == 0) { if (unit->door_address) { device_count(FALSE, unit->door_address); @@ -1593,6 +1610,7 @@ /* Allways turn everything off after a mode change */ unit->PID_I_err = unit->PID_err_old = 0.0; unit->heater_state = unit->cooler_state = unit->fan_state = 0; + unit->heater_wait = unit->cooler_wait = unit->fan_wait = 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); @@ -1635,6 +1653,7 @@ */ unit->PID_I_err = unit->PID_err_old = 0.0; unit->heater_state = unit->cooler_state = unit->fan_state = 0; + unit->heater_wait = unit->cooler_wait = unit->fan_wait = 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);