kinematics: Convert get_rails() method to get_steppers()
All callers of get_rails() actually just want the steppers, so return them directly. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -44,9 +44,8 @@ class PrinterProbe:
|
||||
'QUERY_PROBE', self.cmd_QUERY_PROBE, desc=self.cmd_QUERY_PROBE_help)
|
||||
def build_config(self):
|
||||
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
||||
for rail in kin.get_rails("Z"):
|
||||
for stepper in rail.get_steppers():
|
||||
stepper.add_to_endstop(self.mcu_probe)
|
||||
for stepper in kin.get_steppers('Z'):
|
||||
stepper.add_to_endstop(self.mcu_probe)
|
||||
def setup_pin(self, pin_params):
|
||||
if (pin_params['pin'] != 'z_virtual_endstop'
|
||||
or pin_params['type'] != 'endstop'):
|
||||
|
||||
@@ -18,6 +18,8 @@ class ZTilt:
|
||||
except:
|
||||
raise config.error("Unable to parse z_positions in %s" % (
|
||||
config.get_name()))
|
||||
if len(z_positions) < 2:
|
||||
raise config.error("z_tilt requires at least two z_positions")
|
||||
self.probe_helper = probe.ProbePointsHelper(config, self)
|
||||
self.z_steppers = []
|
||||
# Register Z_TILT_ADJUST command
|
||||
@@ -30,12 +32,7 @@ class ZTilt:
|
||||
self.handle_connect()
|
||||
def handle_connect(self):
|
||||
kin = self.printer.lookup_object('toolhead').get_kinematics()
|
||||
try:
|
||||
z_steppers = kin.get_rails('Z')[0].get_steppers()
|
||||
except:
|
||||
logging.exception("z_tilt stepper lookup")
|
||||
raise self.printer.config_error(
|
||||
"z_tilt requires multiple Z steppers")
|
||||
z_steppers = kin.get_steppers('Z')
|
||||
if len(z_steppers) != len(self.z_positions):
|
||||
raise self.printer.config_error(
|
||||
"z_tilt z_positions needs exactly %d items" % (len(z_steppers),))
|
||||
|
||||
Reference in New Issue
Block a user