pid-controller
pid-controller copied to clipboard
Mismatch between legacy constants and setMode()
in the pid code, the following are defined:
// Constants for backward compatibility
PID.AUTOMATIC = 1;
PID.MANUAL = 0;
I assumed these were to be passed to setMode() - I prefer explicit constants to "magic strings".
However, in setMode(), instead of values 0 and 1, setMode() refers to 1 and 2:
if (Mode == 1 || Mode.toString().toLowerCase() == 'automatic' || Mode.toString().toLowerCase() == 'auto') {
newAuto = 1;
}
else if (Mode == 2 || Mode.toString().toLowerCase() == 'manual') {
newAuto = 0;
}
Shouldn't these correspond?
Yes - it looks like it might be related to this update:
https://github.com/wilberforce/pid-controller/commit/9f62aa5e49491ab70ff046b3d64dd826cad79e47
Do you want to update and do a pull request?