arduino-pid-autotuner
arduino-pid-autotuner copied to clipboard
Update pidautotuner.cpp
Changed the index correction for control constants averages because of the last interation i++.
I was wondering too about the index correctness, but see the conditional block starting at 140:
// Average all gains after the first two cycles
if (cycle > 1) {
pAverage += kp;
iAverage += ki;
dAverage += kd;
}
The decrement seems to derive from that, not from the iteration. i == 1 when 1 cycle has completed. I assume the first cycle is discarded as the process is likely in a cold state and this serves to saturate the process first.