probe_eddy_current: Rework tap_threshold to use hz/mm

Rework the tap_threshold to use units of hz/mm (instead of hz).  This
will make it easier to implement tap calibration based on results of
PROBE_EDDY_CURRENT_CALIBRATE and previous tap attempts.  It can also
make the tap_threshold more stable with different probe speeds and
sensor rates.

As a result of this change, existing user configurations will need to
be updated.  It is hoped that existing configurations will have a
value that is sufficiently low that they will reliably get an error
until they can recalibrate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor committed 2026-05-01 23:31:17 -04:00
1 parent 352bc8b2e3
commit 460ee78340
5 files changed
+27 -22

No files matched your search

+5
View File
@@ -8,6 +8,11 @@ All dates in this document are approximate.
## Changes
20260501: The handling of the `[probe_eddy_current]` `tap_threshold`
config option and associated `TAP_THRESHOLD` G-Code parameter has
changed. It will be necessary to recalibrate the value. See the
[eddy probe documentation](Eddy_Probe.md) for calibration directions.
20260408: The script `lib/canboot/flash_can.py` has been updated to
the most current version from
[Katapult](https://github.com/Arksine/katapult) and as such renamed to
+7 -9
View File
@@ -2350,15 +2350,13 @@ sensor_type: ldc1612
# settings do not have an effect if using a probe "METHOD" of
# "scan", "rapid_scan", or "tap".
#tap_threshold:
# Noise cutoff/stop trigger threshold (in Hz). Specify this value to
# enable support for "METHOD=tap" probe commands. See Eddy_Probe.md
# for more information. Larger values make the tap detection less
# sensitive. That is, larger values make it less likely the toolhead
# will incorrectly stop early due to noise, while increasing the
# risk of the toolhead not correctly stopping when it first contacts
# the bed. If this value is specified then one may override its
# value at run-time using the "TAP_THRESHOLD" parameter on probe
# commands. The default is to not enable support for "tap" probing.
# Descent stop threshold (in Hz/mm) for "tap" probing. Larger values
# reduce the chance of the toolhead incorrectly stopping early due
# to noise, while increasing the risk of the toolhead not correctly
# stopping when it first contacts the bed. See Eddy_Probe.md for
# more information. This value may be overridden at run-time using
# the "TAP_THRESHOLD" parameter on probe commands. The default is
# to not enable "tap" probing.
#tap_z_offset: 0.0
# The Z height (in mm) of the nozzle relative to the bed at the
# contact point detected during "tap" probing. Nominally this would
+5 -6
View File
@@ -137,8 +137,8 @@ PROBE METHOD=tap
Here is an example sequence of threshold values to test:
```
1 -> 5 -> 10 -> 20 -> 40 -> 80 -> 160
160 -> 120 -> 100
50 -> 250 -> 500 -> 1000 -> 2000 -> 4000 -> 8000
8000 -> 6000 -> 5000
```
Your value will normally be between those.
- Too high a value leaves a less safe margin for early collision -
@@ -156,8 +156,8 @@ z: 1.010 # noise 0.000400mm, MAD_Hz=14.000
```
The estimation will be:
```
MAD_Hz * 2
11.314 * 2 = 22.628
MAD_Hz * 100
11.314 * 100 = 113.14
```
To further fine tune threshold, one can use `PROBE_ACCURACY METHOD=tap`.
@@ -173,8 +173,7 @@ the speed of the descent.
If you take 24 photos per second of the moving train, you can only estimate
where the train was between photos.
It is possible to reduce the descending speed. It may require decrease of
absolute `tap_threshold` value.
It is possible to reduce the descending speed.
It is possible to tap over non-conductive surfaces as long as there is metal
behind it within the sensor's sensitivity range.
+9 -6
View File
@@ -529,6 +529,7 @@ class EddyTap:
self._tap_threshold, above=0.)
if not tap_threshold:
raise self._printer.command_error("Tap not configured")
params = self._param_helper.get_probe_params(gcmd)
# Setup mcu filter (scale internal values to milli-hz)
sos_filter = self._trigger_analog.get_sos_filter()
sos_filter.set_filter_design(self._filter_design)
@@ -537,7 +538,9 @@ class EddyTap:
sos_filter.set_offset_scale(0, s, auto_offset=True)
self._trigger_analog.set_raw_range(0, MAX_VALID_RAW_VALUE)
# Set mcu trigger to tap_threshold
samp_thresh = int(FRAC_HZ * tap_threshold + 0.5)
sps = self._sensor_helper.get_samples_per_second()
adj_thresh = tap_threshold * params['probe_speed'] / sps
samp_thresh = int(FRAC_HZ * adj_thresh + 0.5)
self._trigger_analog.set_trigger('diff_peak_gt', samp_thresh)
self._current_tap_threshold = tap_threshold
# Measurement analysis to determine "tap" position
@@ -703,7 +706,7 @@ class EddyTap:
return final_coeffs
def _error_detect(self, msg):
raise self._printer.command_error("Unable to detect tap: %s" % (msg,))
def _analyze_pullback(self, measures, start_time, end_time, speed):
def _analyze_pullback(self, measures, start_time, end_time):
reactor = self._printer.get_reactor()
self._validate_samples_time(measures, start_time, end_time)
# Correlate measurements to toolhead position at time of measurement
@@ -720,10 +723,10 @@ class EddyTap:
z_contact, freq_contact, depress_slope, slope, slope2 = coeffs
reactor.pause(0.)
sps = self._sensor_helper.get_samples_per_second()
contact_slope_delta_per_sample = (depress_slope - slope) * speed / sps
if contact_slope_delta_per_sample < self._current_tap_threshold:
contact_slope_delta = depress_slope - slope
if contact_slope_delta < self._current_tap_threshold:
self._error_detect("insufficient slope delta (%.6f vs %.6f)"
% (contact_slope_delta_per_sample,
% (contact_slope_delta,
self._current_tap_threshold))
if slope >= 0. or slope2 < 0.:
self._error_detect("invalid free air slope (s=%.6f s2=%.6f)"
@@ -764,7 +767,7 @@ class EddyTap:
start_time = retract_start_time - 0.010
end_time = retract_start_time + 0.150
self._gather.add_probe_request(self._analyze_pullback, start_time,
end_time, start_time, end_time, speed)
end_time, start_time, end_time)
def pull_probed_results(self):
return self._gather.pull_probed()
def end_probe_session(self):
+1 -1
View File
@@ -63,7 +63,7 @@ y_offset: -4
sensor_type: ldc1612
speed: 10.0
intb_pin: PK7
tap_threshold: 30
tap_threshold: 1500
[bed_mesh]
mesh_min: 10,10