Prevent PID winding up on lower temps

Should help with #116
This commit is contained in:
Ben V. Brown
2017-12-12 11:55:56 +11:00
parent c5c89a516e
commit 5b4ed06013

View File

@@ -880,12 +880,18 @@ void startPIDTask(void const * argument) {
output = 0; output = 0;
} else } else
backoffOverflow = 0; backoffOverflow = 0;
if (currentlyActiveTemperatureTarget < rawTemp) {
output = 0;
integralCount = 0;
backoffOverflow = 0;
derivativeLastValue = 0;
}
setTipPWM(output); setTipPWM(output);
} else { } else {
setTipPWM(0); //disable the output driver if the output is set to be off elsewhere setTipPWM(0); //disable the output driver if the output is set to be off elsewhere
integralCount = 0; integralCount = 0;
backoffOverflow = 0; backoffOverflow = 0;
derivativeLastValue = 0;
} }
derivativeLastValue = rawTemp; //store for next loop derivativeLastValue = rawTemp; //store for next loop
HAL_IWDG_Refresh(&hiwdg); HAL_IWDG_Refresh(&hiwdg);