Skip to content

Commit

Permalink
probe_eddy_current: Add support for probing in "scan" mode
Browse files Browse the repository at this point in the history
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 <kevin@koconnor.net>
  • Loading branch information
KevinOConnor committed Jun 14, 2024
1 parent aa0dbf6 commit fcf064b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion klippy/extras/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def start_probe(self, gcmd):
def_move_z = self.default_horizontal_move_z
self.horizontal_move_z = gcmd.get_float('HORIZONTAL_MOVE_Z',
def_move_z)
if probe is None or method != 'automatic':
if probe is None or method == 'manual':
# Manual probe
self.lift_speed = self.speed
self.probe_offsets = (0., 0., 0.)
Expand Down
33 changes: 33 additions & 0 deletions klippy/extras/probe_eddy_current.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,34 @@ def probe_finish(self, hmove):
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):
Expand All @@ -389,6 +417,11 @@ def get_offsets(self):
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):
Expand Down

0 comments on commit fcf064b

Please sign in to comment.