gcode_M600_filament_change_z_shift is almost useless, since it performs
what is already been done internally by filament_unload().
However it *does* cause the carriage to raise earlier during unload
compared to making the user wait after "press for unload".
Change it so the calculated Z height matches MIN_Z_FOR_SWAP.
This change restores the minimum extruder height for filament purge
during M600 from the current 50mm back to 27mm from FW 3.9.
We do this by introducing a new option for unload_filament() to indicate
that the unload is part of an automatic swap, and in such cases avoid
raising more than absolutely necessary (this will _also_ come in handy
to avoid the extra purge in PR #2318 during M600).
A new define MIN_Z_FOR_SWAP is introduced for this purpose.
MIN_Z_FOR_UNLOAD is still used for manual lcd unload and for M702 and
hasn't been changed.
mesh_bed_leveling_flag and homing_flag should be set only when the
planner is empty as a consequence of #3100, since any operation executed
*while* the mbl/homing flag is set is considered part of the compound
instruction that generated it (G80, G28, G30, G76).
Failure in doing so can result in instructions just prior being lost,
since they're incorrectly discarded (assumed to be redone).
G1 ; lost ..
G80 ; .. if PP happens here
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>