Fix Deadlok problem when there is only a heater or a cooler.

Thu, 17 Mar 2016 17:25:02 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 17 Mar 2016 17:25:02 +0100
changeset 494
092b45686a75
parent 493
04d726035afe
child 495
712984fdd26b

Fix Deadlok problem when there is only a heater or a cooler.

thermferm/thermferm.c file | annotate | diff | comparison | revisions
--- 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) {

mercurial