-
-
Notifications
You must be signed in to change notification settings - Fork 46
add TOOLSHIFT=0 support while printing #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update the toolhead movement logic in the G-code macro configuration for dual carriage operations. The revised code introduces a nested conditional structure that checks the Changes
Sequence Diagram(s)sequenceDiagram
participant Macro
participant T0
participant T1
Macro->>Macro: Check toolshift flag
alt toolshift true
Macro->>Macro: Compare distances (T0 vs T1)
alt T0 distance ≥ T1 distance
Macro->>T1: Execute Copy Command (mode A)
Macro->>T0: Execute Move Command for T0
Macro->>T1: Execute Parking Command
else T0 distance < T1 distance
Macro->>T1: Execute Copy Command (mode B)
Macro->>T0: Execute Move Command for T0
Macro->>T1: Execute Parking Command
end
else toolshift false
Macro->>T1: Execute Parking Command
Macro->>T0: Execute Move Command for T0
end
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
configuration/macros/idex/toolheads.cfg (3)
464-488
: Consider DRY-ing the conditional logic and improving readability.
The nested conditions fortoolshift
and comparingt0_distance
vs.t1_distance
largely duplicate lines of code in both branches. Extracting common operations (like parking T1 or moving T0) into separate helper macros would make this logic more concise and easier to maintain down the line.
542-565
: Unify the approach for T0 and T1 to reduce duplicate patterns.
This block mirrors the previous approach for T0 but includes very similar commands for T1. Merging these into a single function or macro call with parameters for tool indices and distances can simplify maintenance and reduce potential inconsistencies between T0 and T1 logic.
542-565
: Check if the “copy move” and “park” operations should handle Z safely.
Similar to the T0 block above, there is no explicit Z-hop or additional clearance step before the “copy move” or “park T0/T1” lines. In certain printers, moving on the X-axis alone without a Z-lift may risk collision when the tools are close. Consider an optional Z-hop or collision check if your hardware tolerances are tight.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
configuration/macros/idex/toolheads.cfg
(2 hunks)
🔇 Additional comments (1)
configuration/macros/idex/toolheads.cfg (1)
464-488
: Verify collision-safety when performing copy moves.
When using these copy moves (lines 469, 478), ensure that there is enough clearance on the Y-axis, especially ifnew_y + yoffset
might exceed the physical limits or get too close to the parked toolhead’s location. If there's a risk of collision or out-of-bounds movement, consider adding boundary checks or explicitly homing the axes to ensure safe movements.
While troubleshooting a problem, I noticed that _SELECT_TOOL TOOLSHIFT=0 does not work when printing.
With this small fix it now works while printing.
Toolshift can now be disabled during printing with another T0/T1 override.
[gcode_macro T0] gcode:
{% set x = params.X|default(-1.0)|float %}
{% set y = params.Y|default(-1.0)|float %}
{% set z = params.Z|default(0.0)|float %}
{% set s = params.S|default(1)|int %}
{% if printer["gcode_macro _SELECT_TOOL"] is defined %}
_SELECT_TOOL T=0 X={x} Y={y} Z={z} TOOLSHIFT=0
{% endif %}
Removing XYZ to force it to disable toolshift messes up the z-hop
Summary by CodeRabbit