Repository navigation
Start the extruder retract of a coordinated unload at once (unload fails mid-print) - #47
Open
marcelozani wants to merge 1 commit into
Open
marcelozani wants to merge 1 commit into
marcelozani wants to merge 1 commit into
Conversation
The coordinated unload queues the extruder retract without waiting for it and then waits on the ACE retract. While a print runs, Klipper keeps that move in its look-ahead until more moves arrive, and none do while the driver waits: the ACE pulls against the stationary extruder gears and the unload ends with "Toolhead sensor still triggered". Idle or paused the same unload works, so Retry from the pause always succeeds. Hand the queued move to the steppers right away, as the intake-gated transfer already does for its extruder stretches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
During a print, toolchange unloads (and the unload in
PRINT_END) fail withThe same unload works when the printer is idle or paused, and Retry from the pause dialog always succeeds.
Root cause
In the coordinated retract of
_smart_unload()(the non-transfer branch), the extruder retract is queued with_extruder_move(..., wait_for_move_end=False), which only callstoolhead.move(). The driver then starts the ACE retract and waits on it. While a print runs, Klipper keeps that move in its look-ahead until more moves arrive, and none arrive while the driver waits. So the extruder does not retract: its gears keep gripping the filament while the ACE pulls the whole length. Idle or paused, the toolhead flushes the move right away, which is why the retry works.Evidence from
klippy.logduring a 27 s ACE retract mid-print: theStatslines showprint_timefrozen at the same value andbuffer_time=0.000, so the extruder move never reached the MCU.Fix
Call
_start_queued_toolhead_moves()right after queuing the extruder retract, before the ACE retract starts. That is the helper the intake-gated transfer already uses in_extruder_stretch()for the same reason. The move still runs concurrently with the ACE retract and is waited for with_wait_toolhead_move_finished()as before.Tests
test_coordinated_retract_starts_the_extruder_before_the_ace_pullsintests/test_manager_unload_paths.py: checks the order extruder retract → start queued moves → ACE retract. It fails without the fix._extruder_movenow mock_start_queued_toolhead_movestoo (tests/test_manager.py,tests/test_unload_rdm_guard.py).bash tests/run_all_tests.sh: 2106 passed, 9 skipped, flake8 clean.Hardware
Voron 2.4 with mainline Klipper, ACE Pro gen 1 (fw V1.3.863), Stealthburner + Clockwork 2 + FilamATrix cutter, toolhead sensor in front of the extruder gears.
I validated the fix on
dev@ 7cf0d73 with the equivalent flush (toolhead.get_last_move_time()) inside_extruder_move(). A mid-print test G-code (heat, a few XY moves,Tn, more moves) failed 3 of 3 times before the fix. After it, the toolhead sensor cleared after 1.8 s, and unload, load, purge and the rest of the print were fine. This PR applies the same flush on top of currentdevthrough the existing helper.After that I still had a few unload failures with a different signature (the extruder moved, but the filament stayed at the gears). They were mechanical on my side, and since I fixed the mechanics the unload has not failed again. One more thing helped on a cutter toolhead: a short push forward right before the cut. The pressure keeps the filament from creeping up, so the cut tip stays clean and the next filament seats easily. I did that in my
CUT_TIPmacro, not in the driver, and this PR does not touch it.🤖 Generated with Claude Code