Closed br3ttb closed 11 years ago
yes... looks like
changed the size to 101.
Thanks for your PID library and the autotuner. Two questions:
Looking at the code, it appears that the PID should be set to MANUAL while the autotuner is running, and that the autotuner controls the output in the meantime. Is this correct?
I assume the autotuner doesn't support the PID's REVERSE mode, right?
Question: Wont the following code run off the end of the lastInputs Array?
nLookBack could potentially be 100, in which case 'i' starts at 99, the end of the array, only for lastInputs[100] to eventually be updated. I would think the array should be declared of size 101 to fix this, yes?
for(int8_t i=nLookBack-1;i>=0;i--) { double val = lastInputs[i]; if(isMax) isMax = refVal>val; if(isMin) isMin = refVal<val; lastInputs[i+1] = lastInputs[i]; }