Skip to content

Refactoring and new Features - #180

Open
TitusLabs wants to merge 6 commits into
masterfrom
testing/z-calibration-refactor
Open

Refactoring and new Features#180
TitusLabs wants to merge 6 commits into
masterfrom
testing/z-calibration-refactor

Conversation

@TitusLabs

@TitusLabs TitusLabs commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

This PR modernizes klipper_z_calibration around three goals:

  1. make Klipper/Kalico compatibility assumptions explicit and testable,
  2. improve installation, update, release, and validation workflows,
  3. make the calibration offset application more flexible for toolchanger-style printers.

The runtime behavior of the normal calibration flow is intentionally kept close to the existing plugin: CALIBRATE_Z still measures nozzle, switch and bed positions, validates the calculated offset against offset_margins and applies the result. The larger change is that Klipper/Kalico API access is now isolated behind compatibility helpers and covered by unit and firmware-contract tests.

User-Visible Changes

  • Adds support for configurable offset application through offset_gcode.
    • If unset, the plugin keeps the existing SET_GCODE_OFFSET behavior.
    • If set, the calcualted offset is passed as params.Z to the configured G-Code template.
    • This allows multi-head, IDEX and toolchanger configurations to route the calculated adjustment through printer specific macros.
  • Adds optional error_gcode.
    • If configured, it runs when CALIBRATE_Z raises an error.
    • The original error is still raised after the hook runs.
    • The error text is passed as params.ERROR.
    • If error_gcode itself fails, that failure is logged without masking the original calibration error.
  • Removes legacy configuration names older two years from the current documented configuration path:
    • max_deviation is replaced by offset_margins.
    • clearance is replaced by safe_z_height.
  • Updates the README with the current support scope, install notes, Moonraker update behavior and compatibility guidance.

How to Test

In the Moonraker config change the primary_branch to testing/z-calibration-refactor and channel to dev:

[update_manager z_calibration]
primary_branch: testing/z-calibration-refactor
channel: dev
...

How to Revert

Remove the primary_branch in the Moonraker config and change the channel to stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant