Fix cmd overflow introduced in 186ce0f.
With a precision of %f being .6 and assuming a maximum (theoretical)
acceleration of 99999 we need 47 bytes including terminating byte.
Round it to 48
This is handled in the same way crash detection is handled: homing/mbl
invalidates saved_target _and_ current position.
Fixes PP recovery during MBL and homing.
At a higher level, crash detection will repeat the last gcode command.
Some commands such as G28 or G80 need to be repeated in full and require
special handling.
In such cases, do not store the saved target coordinate (which is fake
in such cases) and invalidate the saved position.
This fixes the last coordinate of the first G1 move after recovery.
We also avoid moving from the origin when the saved position is
invalidated, which is not strictly necessary, but saves some time.
Crash detection is handled at a higher level (which automatically
repeats the current command), however we still need to abort the current
command correctly.
Handle XY crashes by checking the planner status after st_synchronize().
No actual changes done in the function in this, besides break->return.
In G28, simply call the new function instead of using goto, making the
code more readable.
Also remove the senseless comments in G28 about command queuing (dating
back to when G80 was queued instead of being executed).
As done when initializing the printer from a cold start, we need to
clamp the starting position to software endstops before setting the
planner position since 0,0 is frequently out-of-bounds.
This avoids an useless move during recovery that can cause a crash:
- Initial X is set to be 0
- G1 performed by homing will clamp X>=0, resulting in a positive shift
- If X is already at max X (extruder being parked due to PP), this will
slam at X+, causing an immediate crash.