Fix stringing: support spiral lift/Z-hop with timelapse gcode injections #5736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the successor of #4848 and #4631. For a detailed explanation why injection of gcode for timelapse causes stringing, please see both PRs.
Summary
This PR improves the injection of timelapse gcode so that a lift/Z-hop operation is executed before the timelapse gcode is injected. When the print head returns from the timelapse macro position, no spiral Z-hop is generated in the slicer anymore - this was causing collisions. After thinking about the process (for a long time), I noticed that we do not actually require two Z-hops.
I created a diagram to show the differences.
Previous Implementation
Proposed Implementation
Details
To use only one Z-hop, we need to immediately execute one before the timelapse gcode is injected. With the current implementation (
lift
), this is not possible, since these operations are "scheduled"/"queued" to be executed at a later point (when usingtravel_to_xyz()
).This PR adds the new function
travel_lift
which immediately executed a lift operation to a givenz
height and flags existing scheduled/queued lift operations to be done (m_lifted = delta_z; m_to_lift = 0;
).Furthermore, it removes the second Z-hop from the
timelapse_gcode
in the printer profile, since we now can rely it was executed.Essentially, this means that no Z-hop will be executed within or after the timelapse gcode and thus, no collisions can occur because of an unknown position:
Testing
Since I have an AMS Lite now (thanks BambuLab and thanks @SaltWei!) I was able to test all different injection scenarios/positions. With and without AMS Lite, with/without purge/wiper tower. However I assume it would be great if BambuLab test on their end too.
Happy for your feedback!