Skip to content

tool_probe: update for latest Klipper probe API - #174

Open
orion23rigel wants to merge 2 commits into
viesturz:mainfrom
orion23rigel:tool-probe-latest-klipper-api
Open

tool_probe: update for latest Klipper probe API#174
orion23rigel wants to merge 2 commits into
viesturz:mainfrom
orion23rigel:tool-probe-latest-klipper-api

Conversation

@orion23rigel

@orion23rigel orion23rigel commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Updates the tool probe integration for recent Klipper probe API changes.

Recent Klipper versions changed the internal probe virtual-endstop and probe-session APIs. With current Klipper, klipper-toolchanger can fail during startup with:

Internal error during connect: __init__() takes from 3 to 4 positional arguments but 5 were given

This updates the tool probe code to use the current probe API:

  • Pass ProbeOffsetsHelper and ProbeParameterHelper to ProbeEndstopWrapper
  • Replace ProbeSessionHelper with SampleAveragingHelper
  • Route probe sessions to the currently active tool probe
  • Use Klipper's standard HomingViaProbeHelper to register probe:z_virtual_endstop
  • Remove obsolete MCU-endstop proxy bindings that current ProbeEndstopWrapper no longer exposes

Current Klipper uses get_position_endstop only to identify virtual-probe homing; the active probe session supplies the actual per-tool probe offset. Therefore the standard helper can use a static marker value while probe results remain dynamically routed through the active tool probe.

Testing

Validated on a toolchanger printer running current Klipper. Standalone Z homing and print-start probing correctly respect the active tool probe offset after removing an unrelated legacy config-level coordinate override.

Also validated against upstream Klipper 2fb3d54e2 and ran:

python3 -m py_compile klipper/extras/tool_probe.py klipper/extras/tool_probe_endstop.py
git diff --check origin/main...HEAD

@orion23rigel
orion23rigel force-pushed the tool-probe-latest-klipper-api branch from 180da5b to 0bded50 Compare June 7, 2026 13:50
Vylyne pushed a commit to Vylyne/klipper-toolchanger-easy that referenced this pull request Jun 15, 2026
Recent Klipper versions (post May 2026) significantly refactored the
probe module internals:

- ProbeEndstopWrapper now requires (config, probe_offsets, param_helper)
  instead of just (config)
- ProbeSessionHelper was renamed to SampleAveragingHelper
- HomingViaProbeHelper was simplified to (config, position_endstop,
  query_endstop_cb) — it no longer accepts mcu_probe/offsets/param_helper
- ProbeEndstopWrapper no longer exposes home_start/home_wait/
  multi_probe_begin/multi_probe_end — probing now goes through
  start_probe_session()/run_probe()/pull_probed_results()

This updates tool_probe.py and tool_probe_endstop.py to use the current
Klipper probe API:

- Pass ProbeOffsetsHelper and ProbeParameterHelper to ProbeEndstopWrapper
- Use Klipper's SampleAveragingHelper instead of the custom
  ProbeSessionHelper (preserves multi-sample averaging and tolerance)
- Delegate probe params to ProbeParameterHelper
- Use standard HomingViaProbeHelper to register probe:z_virtual_endstop
- Remove obsolete EndstopRouter MCU-endstop proxy bindings that current
  ProbeEndstopWrapper no longer exposes
- Remove ToolProbeOffsetsHelper (no longer needed)

Without this fix, Klipper fails at startup with:
  __init__() takes from 3 to 4 positional arguments but 2 were given

Adapted from viesturz/klipper-toolchanger PR viesturz#174.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AcrimoniousMirth

Copy link
Copy Markdown

Looking forward to official merge! Running a dirty copy atm with the fix.

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.

2 participants