Repository navigation
exclude_object: drop the skipped-object offset after a park outside the transform (fixes #22) - #24
Draft
alandebortolo wants to merge 1 commit into
Conversation
…he transform Fixes Snapmaker#22 (skip an object, Pause, Resume fails with "Move out of range"). While an object is skipped, exclude_object keeps a per-extruder offset: last skipped G-code position minus last printed position. The U1 pause park (MOVE_TO_DISCARD_FILAMENT_POSITION) moves the head with toolhead.manual_move(), so gcode_move resets its position through exclude_object.get_position(), which returns the parked position plus that stale offset. The next G1 that does not set both X and Y (Resume's _CLIENT_EXTRUDE, an E-only move) carries the wrong XY and is rejected, or, inside the bed, travels there while extruding. get_position() now compares the position below the transform with the last one _normal_move() sent. If they differ, the head was moved outside the transform, so the XYZ offset is zeroed and the last printed position becomes the real one. The E offset is left as it was. Diagnosis and the suggested fix are from the issue's reporter; this patch implements that suggestion. Regression test: tests/test_issue22.py (red on 93cb12f, green with this patch) in github.com/DesignMaster-Solutions/u1-fixpack.
Author
|
Re-checked on 2.1.0 now that it is on Output of that run, with the firmware commit at the top of each file: https://github.com/DesignMaster-Solutions/u1-fixpack/tree/main/docs/evidence/2.1.0/issue-22 (CI now runs it on both 2.0.0 and 2.1.0: https://github.com/DesignMaster-Solutions/u1-fixpack/actions/runs/41927199144). |
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.
Fixes #22.
While an object is skipped,
exclude_objectkeeps a per-extruder XYZ offset (last skipped G-code position minus last printed position). The U1 pause park (MOVE_TO_DISCARD_FILAMENT_POSITION) moves the head withtoolhead.manual_move(), sogcode_moveresets its position throughexclude_object.get_position(), which returns the parked position plus that stale offset. The next G1 that does not set both X and Y (Resume's_CLIENT_EXTRUDE, an E-only move) carries the wrong XY and is rejected with "Move out of range", or, inside the bed, travels there while extruding.The same happens with no pause at all: the U1 tool change and the chute park are
manual_moves too, and the offset that is stale there is the swapped-in tool's, from the last time it printed the skipped object. @abehrman lost two prints this way on a stock U1 (2.0.0.205): the prime after a swap went past Y max on one, and 222 mm across the part while extruding on the other (#22 (comment)).This implements the fix @SwineFlew931 proposed in the issue:
get_position()compares the position below the transform with the last one_normal_move()sent. If they differ, the head was moved outside the transform, so the XYZ offset is zeroed and the last printed position becomes the real one. The E offset is left as it was. Anymanual_move(pause park, tool change, chute park) leaves those two positions different, which is why one check covers both reports.How I tested it, without a printer. The firmware at 93cb12f runs in Klipper batch mode with the shipped
lava/printer.cfgandfluidd.cfg. A file is printed throughvirtual_sdcard, and Pause and Resume go through the same webhook handlers Moonraker calls, with the shippedINNER_PAUSE/INNER_RESUME. Four cases: pause during the skipped layers, the end-of-print park followed byG1 E30, a park while the object is still being skipped, and a two-colour print where every swap is the U1 Orca profile'schange_filament_gcodeplus the chute prime (SAVE_GCODE_STATE,MOVE_TO_DISCARD_FILAMENT_POSITION, E-only prime,MOVE_TO_XY_IDLE_POSITION_EXTRUDER,RESTORE_GCODE_STATE), with one of the second tool's objects skipped.G1 E30stop withMove out of range on Y axis(33.000 448.500and35.000 450.500); after the park inside the skipped object, the G-code position says X33 while the head is at X45; at the fifth tool change the chuteGET_POSITIONsays toolhead X92.7 Y300.5, gcode X82.7 Y230.5, and theG1 E20prime drags the head to X82.7 Y230.5 while extrudingGET_POSITIONaround every chute prime): on 93cb12f stock, the 2026-10-27 file stops at the 35th tool change withMove out of range on Y axis: 81.489 337.635 10.850(his log:148.989 337.635 10.874, same Y and same stale offset, X differing by his T1 chute X) and the 2026-11-01 file has no error but at the 26th tool change the chute prime moves the head to X28.113 Y202.421 while extruding (his "about (28.1, 202.4)"); with this patch 143 of 143 and 61 of 61 tool changes keep gcode equal to the toolhead and both prints endcomplete(tests/issue22/replay_real.py,docs/evidence/issue-22/real-print-*.txt)Test, fixtures and logs: https://github.com/DesignMaster-Solutions/u1-fixpack (
tests/test_issue22.py,tests/prove.sh,docs/evidence/issue-22/), with CI on every push.Draft because batch mode has no physics and no real sensors: this proves the firmware logic, not a print. I would like a run on a physical U1 before it is marked ready. The 2.1.0 release in #23 does not touch
exclude_object.py, and the patch applies cleanly on it too.Built with AI coding assistance; I reviewed and tested it.