From fcf064ba6851042a12a71975c229a9670b34cf31 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 31 May 2024 16:48:55 -0400 Subject: probe_eddy_current: Add support for probing in "scan" mode When probing in "scan" mode, the toolhead will pause at each position, but does not descend. This can notably reduce the total probing time. Signed-off-by: Kevin O'Connor --- klippy/extras/probe_eddy_current.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'klippy/extras/probe_eddy_current.py') diff --git a/klippy/extras/probe_eddy_current.py b/klippy/extras/probe_eddy_current.py index 7ec2305e..de1f8447 100644 --- a/klippy/extras/probe_eddy_current.py +++ b/klippy/extras/probe_eddy_current.py @@ -363,6 +363,34 @@ class EddyEndstopWrapper: def get_position_endstop(self): return self._z_offset +# Implementing probing with "METHOD=scan" +class EddyScanningProbe: + def __init__(self, printer, sensor_helper, calibration, z_offset, gcmd): + self._printer = printer + self._sensor_helper = sensor_helper + self._calibration = calibration + self._z_offset = z_offset + self._gather = EddyGatherSamples(printer, sensor_helper, + calibration, z_offset) + self._sample_time_delay = 0.050 + self._sample_time = 0.100 + def run_probe(self, gcmd): + toolhead = self._printer.lookup_object("toolhead") + printtime = toolhead.get_last_move_time() + toolhead.dwell(self._sample_time_delay + self._sample_time) + start_time = printtime + self._sample_time_delay + self._gather.note_probe_and_position( + start_time, start_time + self._sample_time, start_time) + def pull_probed_results(self): + results = self._gather.pull_probed() + # Allow axis_twist_compensation to update results + for epos in results: + self._printer.send_event("probe:update_results", epos) + return results + def end_probe_session(self): + self._gather.finish() + self._gather = None + # Main "printer object" class PrinterEddyProbe: def __init__(self, config): @@ -389,6 +417,11 @@ class PrinterEddyProbe: def get_status(self, eventtime): return self.cmd_helper.get_status(eventtime) def start_probe_session(self, gcmd): + method = gcmd.get('METHOD', 'automatic').lower() + if method == 'scan': + z_offset = self.get_offsets()[2] + return EddyScanningProbe(self.printer, self.sensor_helper, + self.calibration, z_offset, gcmd) return self.probe_session.start_probe_session(gcmd) def load_config_prefix(config): -- cgit v1.2.3-70-g09d2