Skip to content

Commit

Permalink
generic_cartesian: Use stepper instead of kinematic_stepper in configs
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
  • Loading branch information
dmbutyugin committed Aug 5, 2024
1 parent 60ead2e commit 4ce0755
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
5 changes: 0 additions & 5 deletions klippy/extras/kinematic_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,3 @@ def get_active_axes(self):
return [i for i, c in enumerate(self.kin_coeffs) if c]
def get_carriages(self):
return self.carriages


def LoadKinematicSteppers(config, carriages):
return [KinematicStepper(c, carriages)
for c in config.get_prefix_sections('kinematic_stepper')]
13 changes: 8 additions & 5 deletions klippy/kinematics/generic_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ def _load_kinematics(self, config):
raise config.error(
"Redefinition of carriage %s" % ec.get_name())
carriages[name] = ec
self.steppers = ks.LoadKinematicSteppers(config, carriages)
self.steppers = self._load_steppers(config, carriages)
for s in self.steppers:
for c in s.get_carriages():
carriages.pop(c.get_name(), None)
if carriages:
raise config.error(
"Carriage(s) %s must be referenced by some "
"kinematic_stepper(s) kinematics" % (", ".join(carriages),))
"stepper(s) kinematics" % (", ".join(carriages),))
def _load_steppers(self, config, carriages):
return [ks.KinematicStepper(c, carriages)
for c in config.get_prefix_sections('stepper')]
def get_steppers(self):
return self.steppers
def get_primary_carriages(self):
Expand Down Expand Up @@ -180,9 +183,9 @@ def _check_kinematics(self):
det = mathutil.matrix_det(mat_mul(mat_transp(matr), matr))
if abs(det) < 0.00001:
raise self.printer.config_error(
"Verify configured 'kinematic_stepper'(s) and their "
"'kinematics' specifications, the current configuration "
"does not allow independent movements of all printer axes.")
"Verify configured stepper(s) and their 'kinematics' "
"specifications, the current configuration does not "
"allow independent movements of all printer axes.")
def calc_position(self, stepper_positions):
matr, offs = self._get_kinematics_coeffs()
inv = mathutil.matrix_inv(mat_mul(mat_transp(matr), matr))
Expand Down
12 changes: 6 additions & 6 deletions test/klippy/corexyuv.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,47 @@ position_max: 200
homing_speed: 50
endstop_pin: ^PD4

[kinematic_stepper a]
[stepper a]
kinematics: x+y
step_pin: PF0
dir_pin: PF1
enable_pin: !PD7
microsteps: 16
rotation_distance: 40

[kinematic_stepper b]
[stepper b]
kinematics: u-v
step_pin: PH1
dir_pin: PH0
enable_pin: !PA1
microsteps: 16
rotation_distance: 40

[kinematic_stepper c]
[stepper c]
kinematics: x-y
step_pin: PF6
dir_pin: !PF7
enable_pin: !PF2
microsteps: 16
rotation_distance: 40

[kinematic_stepper d]
[stepper d]
kinematics: u+v
step_pin: PE3
dir_pin: !PH6
enable_pin: !PG5
microsteps: 16
rotation_distance: 40

[kinematic_stepper z]
[stepper z]
kinematics: z
step_pin: PL3
dir_pin: PL1
enable_pin: !PK0
microsteps: 16
rotation_distance: 8

[kinematic_stepper z1]
[stepper z1]
kinematics: z1
step_pin: PG1
dir_pin: PG0
Expand Down
2 changes: 1 addition & 1 deletion test/klippy/corexyuv.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ SET_SERVO servo=my_servo angle=160
SET_SERVO servo=my_servo angle=130

# Verify STEPPER_BUZZ
STEPPER_BUZZ STEPPER='kinematic_stepper d'
STEPPER_BUZZ STEPPER='stepper d'
STEPPER_BUZZ STEPPER=extruder
STEPPER_BUZZ STEPPER=extruder1
12 changes: 6 additions & 6 deletions test/klippy/generic_cartesian.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ position_max: 300
homing_speed: 50
endstop_pin: ^PE4

[kinematic_stepper stepper_x]
[stepper stepper_x]
kinematics: x+y
step_pin: PF0
dir_pin: PF1
enable_pin: !PD7
microsteps: 16
rotation_distance: 40

[kinematic_stepper dual_carriage]
[stepper dual_carriage]
kinematics: u-y1
step_pin: PH1
dir_pin: PH0
enable_pin: !PA1
microsteps: 16
rotation_distance: 40

[kinematic_stepper stepper_y]
[stepper stepper_y]
kinematics: 1*y+0.5*z
step_pin: PF6
dir_pin: !PF7
enable_pin: !PF2
microsteps: 16
rotation_distance: 40

[kinematic_stepper stepper_y1]
[stepper stepper_y1]
kinematics: 1*y1-0.5*z1
step_pin: PE3
dir_pin: !PH6
enable_pin: !PG5
microsteps: 16
rotation_distance: 40

[kinematic_stepper stepper_z]
[stepper stepper_z]
kinematics: z
step_pin: PL3
dir_pin: PL1
enable_pin: !PK0
microsteps: 16
rotation_distance: 8

[kinematic_stepper stepper_z1]
[stepper stepper_z1]
kinematics: z1
step_pin: PG1
dir_pin: PG0
Expand Down
2 changes: 1 addition & 1 deletion test/klippy/generic_cartesian.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ SET_SERVO servo=my_servo angle=160
SET_SERVO servo=my_servo angle=130

# Verify STEPPER_BUZZ
STEPPER_BUZZ STEPPER='kinematic_stepper dual_carriage'
STEPPER_BUZZ STEPPER='stepper dual_carriage'
STEPPER_BUZZ STEPPER=extruder
STEPPER_BUZZ STEPPER=extruder1

0 comments on commit 4ce0755

Please sign in to comment.