From 2c1fd27dc6eabb9b8bf7eb0a966e4df2c73082f0 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Mon, 2 Nov 2026 17:32:43 +0100 Subject: [PATCH] BDP_TOUCH: default STOP 60 At 2.2 force per 0.01 mm (measured 2026-11-02) the old default of 80 was out of reach within FLOOR from Z0.15 (peak 70 at -0.35); 60 is reached at about 0.27 mm into the bed and still leaves ~100 readings for the fit. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- extras/bdp_touch.py | 18 ++++++++++-------- macros/sensors/touch_compare.cfg | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a2e99d9..06ffc09 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ everything below, grouped by topic. Comment out what you do not use there. | `bdwidth_status.py` | exposes bdwidth's motion counter and width to macros (`present: False` with neutral values when no bdwidth is configured, so the macros also work without it), and keeps a USB dropout of bdwidth (port: usb) from shutting down Klipper: the read is retried every 10 s and the port reopened | | `bdpressure_check.py` | bd_pressure load check (`BDP_CHECK_START/STOP/QUERY`). Needs the load-check firmware from the bd_pressure `load-check-extension` branch; on stock firmware it reports "not available" and does nothing. Also reports how many readings the last `PA_CALIBRATE` got (`pa_points`, `pa_distinct`), used to reject runs with a silent or stuck sensor. | | `bdp_guard.py` | nozzle collision guard: while armed (`BDP_GUARD_ARM/DISARM/QUERY`) reads the bd_pressure force every 20 ms over I2C and, in stop mode, shuts Klipper down when it stays above the threshold. Reports reads, peak and errors per phase in the console and klippy.log. When it arms and finds the sensor still in PA mode (an emergency stop during `PA_CALIBRATE`; `FIRMWARE_RESTART` does not reset the sensor), it switches it to probe mode and takes a new zero first. Puts a lock on the sensor's I2C connection that `bdpressure.py` and `bdpressure_check.py` also go through (Klipper allows one I2C request at a time per device). Needs the load-check firmware. | -| `bdp_touch.py` | `BDP_TOUCH`: lowers the nozzle in one slow continuous move (drip mode, like a homing move) while reading the bd_pressure force as fast as I2C allows (its endstop output is not wired), stops at a force limit (default 80) or 0.5 mm below the start, then lifts back; it must be one quick press, because the sensor re-zeros itself while the force looks steady; reports the height where the force reaches the threshold and the zero-force height from a line fit, and logs the whole curve to klippy.log. `_TOUCH_COMPARE`: alternates that with Beacon's contact probe. Refuses while the bdp_guard is armed or the sensor is in PA mode. Needs the load-check firmware. | +| `bdp_touch.py` | `BDP_TOUCH`: lowers the nozzle in one slow continuous move (drip mode, like a homing move) while reading the bd_pressure force as fast as I2C allows (its endstop output is not wired), stops at a force limit (default 60) or 0.5 mm below the start, then lifts back; it must be one quick press, because the sensor re-zeros itself while the force looks steady; reports the height where the force reaches the threshold and the zero-force height from a line fit, and logs the whole curve to klippy.log. `_TOUCH_COMPARE`: alternates that with Beacon's contact probe. Refuses while the bdp_guard is armed or the sensor is in PA mode. Needs the load-check firmware. | ### Scripts (`scripts/`) diff --git a/extras/bdp_touch.py b/extras/bdp_touch.py index 875bfa9..c404200 100644 --- a/extras/bdp_touch.py +++ b/extras/bdp_touch.py @@ -24,12 +24,14 @@ # the TOUCH_COMPARE macro (macros/sensors/touch_compare.cfg), which heats # the nozzle and homes first. # -# Safety: the move stops when the force reaches STOP (default 80, about -# 0.3 mm into the bed; a purge peaks at 64-246) and overshoots by what was -# already queued (at most ~0.15 s of the move, ~0.05 mm at 0.3 mm/s). The -# descent ends at FLOOR below the start, and the nozzle always goes back up -# to the start height, also after an error. It refuses to run while the bdp_guard is armed (in stop -# mode the touch would shut Klipper down) or while the sensor is in PA mode. +# Safety: the move stops when the force reaches STOP (default 60, about +# 0.27 mm into the bed at 2.2 per 0.01 mm; 80 was out of reach within +# FLOOR from Z0.15: peak 70 at -0.35; a purge peaks at 64-246) and +# overshoots by what was already queued (at most ~0.15 s of the move, +# ~0.05 mm at 0.3 mm/s). The descent ends at FLOOR below the start, and +# the nozzle always goes back up to the start height, also after an error. +# It refuses to run while the bdp_guard is armed (in stop mode the touch +# would shut Klipper down) or while the sensor is in PA mode. # # Install: copy to ~/klipper/klippy/extras/bdp_touch.py (install.sh links # it) and add @@ -38,7 +40,7 @@ # sensor: bd_pa # name after "bdpressure" in [bdpressure bd_pa] # # Commands: -# BDP_TOUCH [THRESHOLD=15] [STOP=80] [SPEED=0.3] [FLOOR=0.5] +# BDP_TOUCH [THRESHOLD=15] [STOP=60] [SPEED=0.3] [FLOOR=0.5] # touch at the current X/Y, starting at the current Z (SPEED in mm/s) # _TOUCH_COMPARE [N=10] [START=0.1] [THRESHOLD=..] [STOP=..] [SPEED=..] # the comparison loop; START is the BDP_TOUCH start height above the @@ -263,7 +265,7 @@ class BDPTouch: def _touch_params(self, gcmd): return dict( threshold=gcmd.get_float('THRESHOLD', 15., above=0.), - stop=gcmd.get_float('STOP', 80., above=0., maxval=150.), + stop=gcmd.get_float('STOP', 60., above=0., maxval=150.), speed=gcmd.get_float('SPEED', 0.3, minval=0.05, maxval=1.), floor=gcmd.get_float('FLOOR', 0.5, above=0., maxval=1.)) diff --git a/macros/sensors/touch_compare.cfg b/macros/sensors/touch_compare.cfg index c14df26..fece837 100644 --- a/macros/sensors/touch_compare.cfg +++ b/macros/sensors/touch_compare.cfg @@ -1,7 +1,7 @@ # Touch comparison: Beacon contact vs bd_pressure (needs extras/bdp_touch.py # and the bd_pressure load-check firmware). See extras/bdp_touch.py. # -# TOUCH_COMPARE [N=10] [X=175] [Y=175] [TEMP=150] [THRESHOLD=15] [STOP=80] +# TOUCH_COMPARE [N=10] [X=175] [Y=175] [TEMP=150] [THRESHOLD=15] [STOP=60] # [SPEED=0.3] [START=0.1] # Nozzle to TEMP (Beacon contact refuses above 180C), HOME (contact Z), # then N pairs at X/Y: one Beacon contact probe, one BDP_TOUCH starting @@ -33,6 +33,6 @@ gcode: G90 G1 X{x} Y{y} Z5 F6000 M400 - _TOUCH_COMPARE N={params.N|default(10)|int} START={params.START|default(0.1)|float} THRESHOLD={params.THRESHOLD|default(15)|float} STOP={params.STOP|default(80)|float} SPEED={params.SPEED|default(0.3)|float} + _TOUCH_COMPARE N={params.N|default(10)|int} START={params.START|default(0.1)|float} THRESHOLD={params.THRESHOLD|default(15)|float} STOP={params.STOP|default(60)|float} SPEED={params.SPEED|default(0.3)|float} M104 S0 {% endif %}