Skip to content

Commit

Permalink
generic_cartesian: Fixed parsing of section names
Browse files Browse the repository at this point in the history
This also adds a proper implementation for the short names for
kinematic steppers for future reference.

Signed-off-by: Dmitry Butyugin <[email protected]>
  • Loading branch information
dmbutyugin committed Oct 3, 2024
1 parent b1b03ee commit 28b6bf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion klippy/extras/kinematic_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def __init__(self, config, carriages):
self.kin_coeffs[0], self.kin_coeffs[1], self.kin_coeffs[2])
self.stepper_sk = self.stepper.get_stepper_kinematics()
# Add stepper methods
self.get_name = self.stepper.get_name
self.get_step_dist = self.stepper.get_step_dist
self.units_in_radians = self.stepper.units_in_radians
self.get_pulse_duration = self.stepper.get_pulse_duration
Expand Down Expand Up @@ -95,6 +94,11 @@ def __init__(self, config, carriages):
# Add stepper to the carriages it references
for sc in self.carriages:
sc.add_stepper(self)
def get_name(self, short=False):
name = self.stepper.get_name(short)
if short and name.startswith('stepper '):
return name[8:]
return name
def get_kin_coeffs(self):
return tuple(self.kin_coeffs)
def get_active_axes(self):
Expand Down
6 changes: 3 additions & 3 deletions klippy/kinematics/generic_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _load_kinematics(self, config):
carriages = {a : MainCarriage(config.getsection('carriage ' + a), a)
for a in 'xyz'}
dc_carriages = []
for c in config.get_prefix_sections('dual_carriage'):
for c in config.get_prefix_sections('dual_carriage '):
dc_carriages.append(DualCarriage(c, carriages))
for dc in dc_carriages:
name = dc.get_name()
Expand All @@ -211,7 +211,7 @@ def _load_kinematics(self, config):
self.carriages = dict(carriages)
self.dc_carriages = dc_carriages
ec_carriages = []
for c in config.get_prefix_sections('extra_carriage'):
for c in config.get_prefix_sections('extra_carriage '):
ec_carriages.append(ExtraCarriage(c, carriages))
for ec in ec_carriages:
name = ec.get_name()
Expand All @@ -233,7 +233,7 @@ def _check_carriages_references(self, report_error):
"stepper(s) kinematics" % (", ".join(carriages),))
def _load_steppers(self, config, carriages):
return [ks.KinematicStepper(c, carriages)
for c in config.get_prefix_sections('stepper')]
for c in config.get_prefix_sections('stepper ')]
def get_steppers(self):
return self.steppers
def get_primary_carriages(self):
Expand Down

0 comments on commit 28b6bf3

Please sign in to comment.