Skip to content

Make PROBE always retract#841

Draft
garethky wants to merge 1 commit intoKalicoCrew:mainfrom
garethky:pr-probe-always-retract
Draft

Make PROBE always retract#841
garethky wants to merge 1 commit intoKalicoCrew:mainfrom
garethky:pr-probe-always-retract

Conversation

@garethky
Copy link
Contributor

What is changing?

This PR does 2 things:

  • Adds an optional argument to PrinterProbe.run_probe() that allows callers to force it not to retract on the final probing move
  • Adds an optional constructor parameter to PrinterProbe to change the default behavior of run_probe() to always retract. This causes PROBE to always retract on the final probing move.

This allows LoadCellProbe to always retract and leaves other probe types unchanged.

Why is this changing?

Back when run_probe() was originally written there was only 1 kind of probe, a pin based probe that was either triggered or not triggered. This allowed the homing code to check if the probe was triggered before movement and to not move the toolhead if the probe was triggered already. This prevents crashes.

run_probe() was written as a primitive to be used by other code like ProbePointsHelper which manages retract moves between probe points. So run_probe() did not retract on the final move because it assumed that the caller would take responsibility for that.

Now we have load cell probes, a kind of analog probe that cant tell if the probe is triggered just by looking at an analog value. It requires movement to trigger. This means every PROBE requires movement to trigger. Multiple calls to the PROBE command continue to move the toolhead downwards, exerting ever increasing force on the toolhead and bed.

So this changes allows LoadCellProbe to say that it does not want PROBE to end without retracting. Further is creates a contract that any future callers of the run_probe() method will have to pass always_retract=False to take full responsibility for correctly retracting the toolhead.

Alternatives Considered

Don't alter the signature of run_probe()

We could leave the signature of run_probe() as-is and have an internal-only method in PrinterProbe that doesn't retract (i.e. _run_probe()). This breaks the behavior in Z Tilt that uses run_probe(). It doesn't appear that ProbePointsHelper can be used here. Z Tilt seems to assume that the printer has a non-contact sensor (like a proximity sensor) and requires a manual probe to touch off the nozzle. A fix for that would require a callback per-probed point to be added to ProbePointsHelper.

Make retracting the default for all probe types.

This would drop the constructor argument and always default to retracting unless always_retract=False is passed into run_probe(). This might run into issues if there are macros out there using PROBE and expecting the toolhead not to move up afterwards.

Make LoadCellProbe stay triggered until it retracts

Deciding when the probe has reset is actually very difficult. The zero point of the probe drifts over the course of the probing move, so comparing to the initial tare value isn't reliable. You could look at what the force value was just before the trigger, but even that isn't a reliable zero. When the toolhead is retracted upwards its 0 point changes again and might not match what it was when it triggered.

An alternate approach might be to track the Z position since the last probe and make sure it has moved upwards at least by some minimal value (0.1mm?) since the trigger. But I'm not sure how you would easily track that. horizontal_z_clearance can be quire small so it would have to be a small value to not block normal opperation.

Checklist

  • pr title makes sense
  • added a test case if possible
  • if new feature, added to the readme
  • ci is happy and green

@garethky garethky force-pushed the pr-probe-always-retract branch from d4a7f2f to 6eeb153 Compare February 21, 2026 20:26
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