br3ttb / Arduino-PID-AutoTune-Library

420 stars 225 forks source link

Checking wrong variable #25

Open et05hk6 opened 2 years ago

et05hk6 commented 2 years ago

Checking a value that can be either value*4 or 100 (only assignment I can find is in SetLookbackSec(value)) to see if it is smaller than 9 does not seem right to me? Only occation that could be true is if SetLookbackSec(1) has been called by the user... Based on the comment I would do something like this:

if (lastInputs[nLookBack] == 0)

https://github.com/br3ttb/Arduino-PID-AutoTune-Library/blob/7c03cf3e7cd4986e63e7e5ce9a8ff2bc222f8578/PID_AutoTune_v0/PID_AutoTune_v0.cpp#L80