# HG changeset patch # User Michiel Broek # Date 1458231902 -3600 # Node ID 092b45686a75d41040d2c9bef7fde6929051730c # Parent 04d726035afeb992dfb1d997694518ebfe847d35 Fix Deadlok problem when there is only a heater or a cooler. diff -r 04d726035afe -r 092b45686a75 thermferm/thermferm.c --- a/thermferm/thermferm.c Thu Mar 17 17:10:41 2016 +0100 +++ b/thermferm/thermferm.c Thu Mar 17 17:25:02 2016 +0100 @@ -1377,7 +1377,6 @@ * This is our current step */ valid_step = TRUE; -// unit->prof_fridge_mode = step->fridge_mode; if (debug) fprintf(stdout, "step=%d step_pos=%d step=%d/%d target=%.1f..%.1f ", current_step, run_hours - time_until_now, @@ -1564,6 +1563,8 @@ syslog(LOG_NOTICE, "Heat: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f", unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP); } + } else { + unit->PID_heat->OutP = 0.0; } if (unit->cooler_address) { /* @@ -1579,18 +1580,18 @@ syslog(LOG_NOTICE, "Cool: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f", unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP); } + } else { + unit->PID_cool->OutP = 0.0; } /* - * Deadlock + * Deadlock, kill lowest value. */ if (unit->PID_cool->OutP && unit->PID_heat->OutP) { - syslog(LOG_NOTICE, "Heat and Cool lockdown"); if (unit->PID_cool->OutP > unit->PID_heat->OutP) unit->PID_heat->OutP = 0.0; else unit->PID_cool->OutP = 0.0; -// unit->PID_cool->OutP = unit->PID_heat->OutP = 0.0; } if (unit->heater_address && ! unit->cooler_state) {