aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/probe.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-09-26 19:29:58 -0400
committerKevinOConnor <kevin@koconnor.net>2018-10-01 11:12:30 -0400
commitc5d4e14298525e0a184f42f812041b32dfea6951 (patch)
treeec9dc78e55e4cf862df408ffddb35e37ab19c33e /klippy/extras/probe.py
parenta9a0bb87fa472c470d5cbd4ffc78e1acb29a04c1 (diff)
downloadkutter-c5d4e14298525e0a184f42f812041b32dfea6951.tar.gz
kutter-c5d4e14298525e0a184f42f812041b32dfea6951.tar.xz
kutter-c5d4e14298525e0a184f42f812041b32dfea6951.zip
probe: Infer position_endstop when using probe:z_virtual_offset
Don't require (or permit) the user to specify a stepper_z position_endstop when using the probe:z_virtual_offset mechanism. In that case the position_endstop should always equal the probe's z_offset - so no need to have the user specify it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/probe.py')
-rw-r--r--klippy/extras/probe.py27
1 files changed, 7 insertions, 20 deletions
diff --git a/klippy/extras/probe.py b/klippy/extras/probe.py
index 5b503610..5034ecf0 100644
--- a/klippy/extras/probe.py
+++ b/klippy/extras/probe.py
@@ -38,7 +38,6 @@ class PrinterProbe:
self.mcu_probe = ProbeEndstopWrapper(config, self.mcu_probe)
# Create z_virtual_endstop pin
ppins.register_chip('probe', self)
- self.z_virtual_endstop = None
# Register PROBE/QUERY_PROBE commands
self.gcode = self.printer.lookup_object('gcode')
self.gcode.register_command(
@@ -54,15 +53,9 @@ class PrinterProbe:
raise pins.error("Probe virtual endstop only useful as endstop pin")
if pin_params['invert'] or pin_params['pullup']:
raise pins.error("Can not pullup/invert probe virtual endstop")
- self.z_virtual_endstop = ProbeVirtualEndstop(
- self.printer, self.mcu_probe)
- return self.z_virtual_endstop
+ return ProbeVirtualEndstop(self, self.mcu_probe)
def get_offsets(self):
return self.x_offset, self.y_offset, self.z_offset
- def last_home_position(self):
- if self.z_virtual_endstop is None:
- return None
- return self.z_virtual_endstop.position
cmd_PROBE_help = "Probe Z-height at current XY position"
def cmd_PROBE(self, params):
toolhead = self.printer.lookup_object('toolhead')
@@ -112,25 +105,24 @@ class ProbeEndstopWrapper:
self.gcode.run_script_from_command(self.deactivate_gcode)
self.mcu_endstop.home_finalize()
-# Wrapper that records the last XY position of a virtual endstop probe
+# Wrapper for probe:z_virtual_endstop handling
class ProbeVirtualEndstop:
- def __init__(self, printer, mcu_endstop):
- self.printer = printer
+ def __init__(self, probe, mcu_endstop):
+ self.probe = probe
self.mcu_endstop = mcu_endstop
- self.position = None
# Wrappers
self.get_mcu = self.mcu_endstop.get_mcu
self.add_stepper = self.mcu_endstop.add_stepper
self.get_steppers = self.mcu_endstop.get_steppers
self.home_start = self.mcu_endstop.home_start
self.home_wait = self.mcu_endstop.home_wait
+ self.home_finalize = self.mcu_endstop.home_finalize
self.query_endstop = self.mcu_endstop.query_endstop
self.query_endstop_wait = self.mcu_endstop.query_endstop_wait
self.home_prepare = self.mcu_endstop.home_prepare
self.TimeoutError = self.mcu_endstop.TimeoutError
- def home_finalize(self):
- self.position = self.printer.lookup_object('toolhead').get_position()
- self.mcu_endstop.home_finalize()
+ def get_position_endstop(self):
+ return self.probe.get_offsets()[2]
# Helper code that can probe a series of points and report the
# position at each point.
@@ -164,11 +156,6 @@ class ProbePointsHelper:
self.gcode = self.toolhead = None
def get_lift_speed(self):
return self.lift_speed
- def get_last_xy_home_positon(self):
- probe = self.printer.lookup_object('probe', None)
- if probe is None:
- return None
- return probe.last_home_position()
def _lift_z(self, z_pos, add=False, speed=None):
# Lift toolhead
curpos = self.toolhead.get_position()