kinematics: Remove support for identifying Z steppers

The caller can now determine which steppers are connected to cartesian
Z movement via the new stepper.is_active_axis() method.  It is
therefore no longer necessary for the kinematic code to identify these
steppers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-01-13 21:39:55 -05:00
parent d1972b1e9c
commit 8ed0f7c5c3
10 changed files with 14 additions and 18 deletions

View File

@ -62,7 +62,8 @@ class BLTouchEndstopWrapper:
desc=self.cmd_BLTOUCH_DEBUG_help)
def _build_config(self):
kin = self.printer.lookup_object('toolhead').get_kinematics()
for stepper in kin.get_steppers('Z'):
for stepper in kin.get_steppers():
if stepper.is_active_axis('z'):
self.add_stepper(stepper)
def handle_connect(self):
try:

View File

@ -241,7 +241,8 @@ class ProbeEndstopWrapper:
self.TimeoutError = self.mcu_endstop.TimeoutError
def _build_config(self):
kin = self.printer.lookup_object('toolhead').get_kinematics()
for stepper in kin.get_steppers('Z'):
for stepper in kin.get_steppers():
if stepper.is_active_axis('z'):
self.add_stepper(stepper)
def home_prepare(self):
toolhead = self.printer.lookup_object('toolhead')

View File

@ -16,7 +16,7 @@ class ZAdjustHelper:
self.handle_connect)
def handle_connect(self):
kin = self.printer.lookup_object('toolhead').get_kinematics()
z_steppers = kin.get_steppers('Z')
z_steppers = [s for s in kin.get_steppers() if s.is_active_axis('z')]
if len(z_steppers) != self.z_count:
raise self.printer.config_error(
"%s z_positions needs exactly %d items" % (

View File

@ -49,9 +49,7 @@ class CartKinematics:
self.printer.lookup_object('gcode').register_command(
'SET_DUAL_CARRIAGE', self.cmd_SET_DUAL_CARRIAGE,
desc=self.cmd_SET_DUAL_CARRIAGE_help)
def get_steppers(self, flags=""):
if flags == "Z":
return self.rails[2].get_steppers()
def get_steppers(self):
rails = self.rails
if self.dual_carriage_axis is not None:
dca = self.dual_carriage_axis

View File

@ -39,9 +39,7 @@ class CoreXYKinematics:
self.rails[1].set_max_jerk(max_xy_halt_velocity, max_xy_accel)
self.rails[2].set_max_jerk(
min(max_halt_velocity, self.max_z_velocity), self.max_z_accel)
def get_steppers(self, flags=""):
if flags == "Z":
return self.rails[2].get_steppers()
def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
def calc_tag_position(self):
pos = [rail.get_tag_position() for rail in self.rails]

View File

@ -87,7 +87,7 @@ class DeltaKinematics:
math.sqrt(self.max_xy2), math.sqrt(self.slow_xy2),
math.sqrt(self.very_slow_xy2)))
self.set_position([0., 0., 0.], ())
def get_steppers(self, flags=""):
def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
def _actuator_to_cartesian(self, spos):
sphere_coords = [(t[0], t[1], sp) for t, sp in zip(self.towers, spos)]

View File

@ -7,7 +7,7 @@
class NoneKinematics:
def __init__(self, toolhead, config):
pass
def get_steppers(self, flags=""):
def get_steppers(self):
return []
def calc_tag_position(self):
return [0, 0, 0]

View File

@ -37,9 +37,7 @@ class PolarKinematics:
stepper_bed.set_max_jerk(max_halt_velocity, max_accel)
rail_arm.set_max_jerk(max_halt_velocity, max_accel)
rail_z.set_max_jerk(max_halt_velocity, max_accel)
def get_steppers(self, flags=""):
if flags == "Z":
return self.rails[1].get_steppers()
def get_steppers(self):
return list(self.steppers)
def calc_tag_position(self):
bed_angle = self.steppers[0].get_tag_position()

View File

@ -77,7 +77,7 @@ class RotaryDeltaKinematics:
"Delta max build height %.2fmm (radius tapered above %.2fmm)"
% (self.max_z, self.limit_z))
self.set_position([0., 0., 0.], ())
def get_steppers(self, flags=""):
def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
def calc_tag_position(self):
spos = [rail.get_tag_position() for rail in self.rails]

View File

@ -29,7 +29,7 @@ class WinchKinematics:
s.set_max_jerk(max_halt_velocity, max_accel)
# Setup boundary checks
self.set_position([0., 0., 0.], ())
def get_steppers(self, flags=""):
def get_steppers(self):
return list(self.steppers)
def calc_tag_position(self):
# Use only first three steppers to calculate cartesian position