Repository navigation
Conversation
Opt-in (toolchange_prime_enable) when the prime tower is off. The printer's toolchange_prime_gcode runs after each tool change; the G-code processor scales its extrusion between a minimum and maximum length by the tool's estimated idle time, skips it below a skip time, and primes the full length after any pause or filament change, whose real length is unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the opt-in toolchange_prime_on_printer setting. The prime G-code is then emitted untagged and the U1 template calls a Klipper macro, SMART_TOOLCHANGE_PRIME (doc/printer_settings), which times each tool's park with print_stats and primes fully after any pause, including ones pressed on the printer or caused by a filament runout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k way The prime block now extrudes the new tool's parked retraction in the purge chute (a line marked "restore retraction", sized by the new retract_restore_length placeholder), and the writer no longer unretracts it again on the part. Before, the 10 mm unretract landed on the print right after the block, leaving a blob in the same spot on every swap. The prime is now a step instead of a ramp: a tool parked at least toolchange_prime_idle_time (default 60 s) gets the maximum (default 20 mm), a shorter park gets the minimum. The skip time drops only the prime, never the restore. The U1 template and macro end like the stock pre-extrusion: a 0.5 mm retraction, the cut and wipe, then MOVE_TO_XY_IDLE_POSITION_EXTRUDER (Y first) inside SAVE/RESTORE_GCODE_STATE, instead of a diagonal travel out of the chute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run INNER_DISCARD_FILAMENT_BASE_DISCARD after the wipe, as SM_PRINT_PREEXTRUDE_FILAMENT does, so purged blobs are flicked off at a varying spot instead of piling up where the nozzle leaves the chute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now keeps the Snapmaker presets in submodules/Profiles and deleted resources/profiles/Snapmaker/machine/fdm_U1.json. Take the deletion; the U1 toolchange_prime_gcode has to go to Snapmaker/snapmaker-profiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chute wipe The stock cutter macro rams the head against the chute six times at 10000 mm/s^2. Run at every tool change it can skip steps; two U1 prints with priming on failed on a T3 swap. The U1 profile change is in Snapmaker/snapmaker-profiles#1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review on the tool change prime: - A park at least as long as the idle time always gets the full prime, even when the skip time is longer, matching the printer macro. - After the prime block, emit M82 for absolute-extrusion prints, since the template is told to use M83. - Label a reused tool with no recorded park time "park time unknown", not "first use". - Note that time and filament estimates count primes at full length. - static_cast for next_extruder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Thanks. Addressed in b5b0dad:
All 🤖 Generated with Claude Code |
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.
Description
Multi-tool printers with a purge chute or bucket, like the Snapmaker U1, can prime each tool there after a tool change instead of on a prime tower. The tool still gets a pressure-normalizing prime, but nothing has to be built on the bed. This adds that as an opt-in feature and sizes each prime by how long the tool was parked.
This replaces my earlier drafts that tried to avoid the prime tower by flushing into infill or skipping the prime for support-only filaments. Those left the nozzle unprimed, and a tool needs a prime to restore pressure after a park.
How it works
toolchange_prime_gcode) runs after each real tool change when Smart tool change prime (toolchange_prime_enable, off by default) is on. It only runs when the prime tower is off and the printer isn't single-extruder multi-material.prime_length,prime_speed(limited by the filament's max volumetric speed),prime_first_use,retract_restore_length,next_extruder,previous_extruder,new_filament_temp.; restore retractionand sized byretract_restore_length. The G-code writer then counts the tool as unretracted, so it doesn't unretract again on the part.(idle 42s, 3.10mm),(first use, …)or(after pause, …).toolchange_prime_on_printer, off by default). This covers pauses the slicer can't see: a pause pressed on the printer, a filament runout, a long reheat.SMART_TOOLCHANGE_PRIME, which is included indoc/printer_settings/snapmaker-u1-smart-toolchange-prime.cfgand proposed to the firmware in Add SMART_TOOLCHANGE_PRIME to prime a tool by its real park time u1-klipper#21. It times each park withprint_stats.total_durationand primes fully after any pause.prime_first_use, and the U1 template leaves that to the firmware'sSM_PRINT_PREEXTRUDE_FILAMENT.SM_PRINT_PREEXTRUDE_FILAMENT. InsideSAVE_GCODE_STATE/RESTORE_GCODE_STATEit:INNER_CUTOFF_BASE_DISCARD,INNER_ROUGHLY_CLEAN_NOZZLE_BASE_DISCARD,INNER_DISCARD_FILAMENT_BASE_DISCARD);MOVE_TO_XY_IDLE_POSITION_EXTRUDER.Recommended defaults (process settings, "Tool change priming"):
Fixed since the first version
A test print on a U1 lost position on a tool change: the head hit the frame and missed the dock by several inches. The first version had two problems that likely contributed. I can't prove which one caused it.
This version fixes both, as described above. The prime length is also a step now instead of a linear ramp.
The U1 profile change is now in Snapmaker/snapmaker-profiles#1. #1128 moved the presets into the
submodules/Profilessubmodule, sofdm_U1.jsonis no longer in this repo. That PR addstoolchange_prime_gcodeto the U1 profile and bumps the profile version to 02.03.04.05. Merge both, then update the submodule pin.The version bump matters. Without it, the app keeps its cached copy of the U1 profile, so an updated build still slices with the old prime G-code. That happened on a test print: the 2 mm prime ran while the tool was still retracted 10 mm, so nothing came out in the chute, and the 10 mm unretract then left a blob on the part.
No breaking changes: everything is off by default, and nothing changes for printers without tool change prime G-code.
Screenshots/Recordings/Graphs
None. The UI change is six settings in a new "Tool change priming" group on the process "Multimaterial" page, plus the printer's tool change prime G-code field.
Tests
tests/fff_print/test_toolchange_prime.cpp(7 cases): sized as a step by idle time, the retraction restored in the chute with no second unretract on the part, skipped below the skip time, not emitted for single-extruder multi-material printers, off unless enabled, full length after a pause, and left to the printer when timed on the printer.fff_print_testssuite (58 cases), in a Release build on macOS arm64. That run was on my local branch, which has this change plus unrelated work.SMART_TOOLCHANGE_PRIMEwas checked in a Jinja simulation of two prints, including a pause pressed on the printer. It hasn't been tried on a real U1 yet, and neither has this version of the slicer side.Supersedes #1021 and #1022.
🤖 Generated with Claude Code