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.
Attempt to workaround the M73 C0|D0 visual issue
This is an attempt to enable alternation of time to print finish and time
to color change even in the last minute of time to color change, i.e. be
able to print "0:00C".
The proposed solution leverages the capability of the current FW to read
float values from the C|D parameter. This could have the raw benefit of
being able still to alternate this time on the LCD as "0:00C" (or
"<1min") if the slicer sends a non-zero but <1 time right before the
color change.
Co-authored-by: D.R.racer <drracer@drracer.eu>
Co-authored-by: 3d-gussner <3d.gussner@gmail.com>
A fairly mysterious situation happened recently in the MK3 branch.
After merging #3033 (change watchdogReset() into a single inline wdr instruction)
we were unable to flash languages.
Since it looked similarly suspicious like issue #2954 we started investigating deeply.
The problem was in the code as described in the comment in this PR.