The version2 of the firmware is accessible on my Github
It's a "strong PID" tuning where the motor reaches its target. in one shot.
PID coefficients are quite agressive, but overshoot is very limited and motor does not oscillate.
//PID stuff input = getMotorPos(); Kp = 6000; // start with an almost fully proportionnal PID Ki = 20.; Kd = 100. ; myPID.SetTunings(Kp, Ki, Kd); myPID.Compute();
A compensation factor of the "inertia" of the rotor is introduced (should be tuned if you change motor).
This acts as a bias to setpoint value.
//turn the PID on setpoint = targetRot - INERTIA; //setpoint is this target number corrected of the INERTIA bias
Results are impressively good !