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>
This commit is contained in:
Kevin O'Connor
2018-09-26 19:29:58 -04:00
committed by KevinOConnor
parent a9a0bb87fa
commit c5d4e14298
5 changed files with 15 additions and 43 deletions

View File

@@ -121,7 +121,9 @@ class PrinterRail:
mcu_endstop = ppins.setup_pin('endstop', config.get('endstop_pin'))
self.endstops = [(mcu_endstop, self.name)]
stepper.add_to_endstop(mcu_endstop)
if default_position_endstop is None:
if hasattr(mcu_endstop, "get_position_endstop"):
self.position_endstop = mcu_endstop.get_position_endstop()
elif default_position_endstop is None:
self.position_endstop = config.getfloat('position_endstop')
else:
self.position_endstop = config.getfloat(