I haven't looked at v38 code, but the v36 code had what I thought were bugs with phase prediction. I'm not a professional motion control engineer, so take all of this with a grain of salt.
These were the notes I took, but I haven't revisited later firmware versions to see if any of this has changed. I don't really need phase prediction in my application, so I haven't been keeping this updated when I bump up to the new firmware versions.
//phase prediction notes:
//(phase prediction did not take into account that PID results in oscillations around the target and reversing direction occurs as a normal part of finding the target.
//It did not properly handle a negative oscillation from a positive move. Ideally, phase prediction should understand when a particular move starts and when it ends,
//to eliminate introducing error into the movement by carrying over the mean from a target seek in one direction to another target seek in the opposite direction.
//phase prediction should identify the original direction of error and reset the PID calculations when that direction changes.
//Making travel direction work correctly revealed additional issue in the PID algorithm. The threshold is much higher than anticipated (notes below in simplefeedback comments).
// Mean and dx scaling alignment
// corrected mean increase math
// accept error as parameter
// store last error
// compare sign of last error to current error
// clears mean, lastdx, and lastloc when error sign changes
// sets lastloc to currentloc when lastloc is 0 to prevent incorrect error calculations on first pass
//
//simplefeedback notes:
//output threshold is calculated as a function of the microsteps systemparam in order to achieve a realistic amount of adjustment during a processor cycle
// adds threshold comparison to error such that deltas below threshold are not output
// clears lasterror, iterm, i, maxerror, errorcount, lastprobestate, maxma, and probecount when error sign changes - this prevents bleedover from previous error correction into new error correction