diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 7bc54e42d..d0f17269a 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -2326,9 +2326,16 @@ sensor_type: ldc1612 #samples_tolerance: #samples_tolerance_retries: # See the "probe" section for information on these parameters. -#tap_threshold: 0 -# Noise cutoff/stop trigger threshold delta Hz per sample -# See the Eddy_Probe.md for explanation +#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. ``` ### [axis_twist_compensation] diff --git a/docs/Eddy_Probe.md b/docs/Eddy_Probe.md index 8b229545e..aaf50b7ff 100644 --- a/docs/Eddy_Probe.md +++ b/docs/Eddy_Probe.md @@ -123,7 +123,6 @@ and that upon collision it always decreases by at least this value. #samples: 3 #samples_tolerance: 0.025 #samples_tolerance_retries: 3 -tap_threshold: 0 # 0 means tap is disabled ``` Before setting it to any other value, it is necessary to install `scipy`: diff --git a/docs/G-Codes.md b/docs/G-Codes.md index f399138d1..9b876a059 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -1247,6 +1247,9 @@ additional parameters if a `[probe_eddy_current]` section is defined: using `METHOD=rapid_scan` this specifies the measurement time window at each target. If not specified, the default is 0.100 (which is 100ms). +- `TAP_THRESHOLD=`: This overrides the `tap_threshold` + specified in the `[probe_eddy_current]` config section when probing + using `METHOD=tap`. #### PROBE_EDDY_CURRENT_CALIBRATE `PROBE_EDDY_CURRENT_CALIBRATE CHIP=`: This starts a tool diff --git a/klippy/extras/probe_eddy_current.py b/klippy/extras/probe_eddy_current.py index 6b7635de1..a208c154e 100644 --- a/klippy/extras/probe_eddy_current.py +++ b/klippy/extras/probe_eddy_current.py @@ -486,7 +486,7 @@ class EddyTap: self._z_min_position = probe.lookup_minimum_z(config) self._gather = None self._filter_design = None - self._tap_threshold = config.getfloat('tap_threshold', 0., minval=0.) + self._tap_threshold = config.getfloat('tap_threshold', 0., above=0.) if self._tap_threshold: self._setup_tap() # Setup for "tap" probe request @@ -503,7 +503,7 @@ class EddyTap: mcu = self._sensor_helper.get_mcu() sos_filter = trigger_analog.MCU_SosFilter(mcu, cmd_queue, 5) self._trigger_analog.setup_sos_filter(sos_filter) - def _prep_trigger_analog_tap(self): + def _prep_trigger_analog_tap(self, gcmd): if not self._tap_threshold: raise self._printer.command_error("Tap not configured") sos_filter = self._trigger_analog.get_sos_filter() @@ -511,7 +511,9 @@ class EddyTap: sos_filter.set_offset_scale(0, 1., auto_offset=True) self._trigger_analog.set_raw_range(0, MAX_VALID_RAW_VALUE) convert_frequency = self._sensor_helper.convert_frequency - raw_threshold = convert_frequency(self._tap_threshold) + tap_threshold = gcmd.get_float("TAP_THRESHOLD", + self._tap_threshold, above=0.) + raw_threshold = convert_frequency(tap_threshold) self._trigger_analog.set_trigger('diff_peak_gt', raw_threshold) # Measurement analysis to determine "tap" position def _validate_samples_time(self, measures, start_time, end_time): @@ -572,7 +574,7 @@ class EddyTap: trig_pos[0], trig_pos[1], trig_pos[2]) # Probe session interface def start_probe_session(self, gcmd): - self._prep_trigger_analog_tap() + self._prep_trigger_analog_tap(gcmd) self._gather = EddyGatherSamples(self._printer, self._sensor_helper) return self def run_probe(self, gcmd):