in the Compute() function, timeChange is now declared as "unsigned long"
formerly, if left in manual mode for a long time (e.g. during an autotune,) the "int" timeChange would wrap causeing the PID not to calculate for an unacceptable period of time.
This commit is contained in:
parent
98d2779e18
commit
20199df217
|
@ -46,7 +46,7 @@ void PID::Compute()
|
|||
{
|
||||
if(!inAuto) return;
|
||||
unsigned long now = millis();
|
||||
int timeChange = (now - lastTime);
|
||||
unsigned long timeChange = (now - lastTime);
|
||||
if(timeChange>=SampleTime)
|
||||
{
|
||||
/*Compute all the working error variables*/
|
||||
|
|
Loading…
Reference in New Issue