From 7a81bfc4a4651c913add10e34e7431513cf8a5f5 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 3 Sep 2017 15:17:02 -0400 Subject: toolhead: Eliminate set_max_jerk() from kinematic classes Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor --- klippy/corexy.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'klippy/corexy.py') diff --git a/klippy/corexy.py b/klippy/corexy.py index 2069d16b..b22a8dac 100644 --- a/klippy/corexy.py +++ b/klippy/corexy.py @@ -9,22 +9,25 @@ import stepper, homing StepList = (0, 1, 2) class CoreXYKinematics: - def __init__(self, printer, config): + def __init__(self, toolhead, printer, config): self.steppers = [stepper.PrinterHomingStepper( printer, config.getsection('stepper_' + n), n) for n in ['x', 'y', 'z']] self.steppers[0].mcu_endstop.add_stepper(self.steppers[1].mcu_stepper) self.steppers[1].mcu_endstop.add_stepper(self.steppers[0].mcu_stepper) + max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( - 'max_z_velocity', 9999999.9, above=0.) + 'max_z_velocity', max_velocity, above=0., maxval=max_velocity) self.max_z_accel = config.getfloat( - 'max_z_accel', 9999999.9, above=0.) + 'max_z_accel', max_accel, above=0., maxval=max_accel) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 - def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel): + # Setup stepper max halt velocity + max_xy_halt_velocity = toolhead.get_max_axis_halt(max_accel) self.steppers[0].set_max_jerk(max_xy_halt_velocity, max_accel) self.steppers[1].set_max_jerk(max_xy_halt_velocity, max_accel) - self.steppers[2].set_max_jerk(0., self.max_z_accel) + max_z_halt_velocity = toolhead.get_max_axis_halt(self.max_z_accel) + self.steppers[2].set_max_jerk(max_z_halt_velocity, self.max_z_accel) def set_position(self, newpos): pos = (newpos[0] + newpos[1], newpos[0] - newpos[1], newpos[2]) for i in StepList: -- cgit v1.2.3-70-g09d2