ArduPID
ArduPID copied to clipboard
setWindUpLimits Problem with Negative min
I am using setOutputLimits(-128, 127), setBias(0.0) and setWindUpLimits(-100.0, 100.0). My integral tern was being limited to 0.0 and 100.0 until I changed your code to:
double iMax = constrain(outputMax - outTemp, 0, outputMax); // Maximum allowed integral term before saturating output double iMin = constrain(outputMin + outTemp, outputMin, 0); // Minimum allowed integral term before saturating output
which appears to function properly for my case. I also added a debug print of the error term which I find useful.
Thanks! Could you open a PR for an easy fix?