FTMotion: Limit reset-on-threshold e position to avoid precision loss on long prints
Description
Float32 numbers have 23 bits of precision, so the minimum increment ("resolution") around a value x is:
resolution = 2^(floor(log2(|x|)) - 23)
By resetting at ±1'000mm (1 meter), we get a minimum resolution of ~ 0.00006mm, enough for smoothing to work well.
We could reset every mm if we wanted, but that is just a waste of cpu. (this is actually how i tested the code)
Note that "reset" in this context involves adding - current position to all shaping/smoothing/linear advance/stepping buffers too so state is kept consistent and there are no discontinuities.
Requirements
Benefits
Without this, FTMotion accumulates e-position to very large numbers, the floats stop being able to represent single steps and the extruder starts becoming noisy. I made a 300g print test and by the end of it the extruder had became noisy and imprecise.
Configurations
Related Issues
No rush if this is not fixing a common bug. Once you rebase this it will be closer to being reviewable and usable for further development and discussion, which should be interesting!
Need to test this properly
@thisiskeithb, don't merge label can be removed now
@thinkyhead
No rush if this is not fixing a common bug
It happens on any and all long prints, so it is rather important.