Add option to set the offsets via a custom macro #167
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 PR adds a new config variable
offset_macro
.When set to the name of a
gcode_macro
, instead of setting the calculated Z offset viaSET_GCODE_OFFSET
the configured macro is called with a parameterZ
being set to the calculated offset value.The reasoning behind this lies in toolchanging systems, in my case specifically Lineux: https://github.com/Bikin-Creative/Lineux-Toolchanger
For compensating any differences of the different tools in XYZ, all tools are measured against a common reference tool, most often T0.
Upon a toolchange to a different tool then
SET_GCODE_OFFSET
is used to adjust the motion system to the different nozzle position of the tool.This in turn invalidates any changes made by klipper_z_calibration.
This PR now allows to:
CALIBRATE_Z
for T0 calling a custom macro that lets the toolchanging code know about the new offsetExample macro for Lineux:
Lineux then runs
SET_GCODE_OFFSET Z_ADJUST={printer["gcode_macro _btc_Variables"].gcode_offset_z_adjust} MOVE=1
on each toolchange.