probe: Simplify mcu_probe stepper registration

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-07-13 17:14:33 -04:00
parent a31c31aed4
commit 2af73d1006
1 changed files with 4 additions and 6 deletions

View File

@ -43,12 +43,10 @@ class PrinterProbe:
self.gcode.register_command( self.gcode.register_command(
'QUERY_PROBE', self.cmd_QUERY_PROBE, desc=self.cmd_QUERY_PROBE_help) 'QUERY_PROBE', self.cmd_QUERY_PROBE, desc=self.cmd_QUERY_PROBE_help)
def build_config(self): def build_config(self):
toolhead = self.printer.lookup_object('toolhead') kin = self.printer.lookup_object('toolhead').get_kinematics()
z_rails = toolhead.get_kinematics().get_rails("Z") for rail in kin.get_rails("Z"):
for rail in z_rails: for stepper in rail.get_steppers():
for mcu_endstop, name in rail.get_endstops(): stepper.add_to_endstop(self.mcu_probe)
for mcu_stepper in mcu_endstop.get_steppers():
self.mcu_probe.add_stepper(mcu_stepper)
def setup_pin(self, pin_params): def setup_pin(self, pin_params):
if (pin_params['pin'] != 'z_virtual_endstop' if (pin_params['pin'] != 'z_virtual_endstop'
or pin_params['type'] != 'endstop'): or pin_params['type'] != 'endstop'):