Skip to content

Commit 20199df

Browse files
committed
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.
1 parent 98d2779 commit 20199df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PID_v1/PID_v1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void PID::Compute()
4646
{
4747
if(!inAuto) return;
4848
unsigned long now = millis();
49-
int timeChange = (now - lastTime);
49+
unsigned long timeChange = (now - lastTime);
5050
if(timeChange>=SampleTime)
5151
{
5252
/*Compute all the working error variables*/

0 commit comments

Comments
 (0)