diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-09-03 15:17:02 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-09-03 15:45:04 -0400 |
commit | 7a81bfc4a4651c913add10e34e7431513cf8a5f5 (patch) | |
tree | 7f3a40804dd52154d864cc71e7a120cddecf4725 /klippy/cartesian.py | |
parent | 0d13834293d0b5db2fc3407bd603dbfaa691402d (diff) | |
download | kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.gz kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.xz kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.zip |
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/cartesian.py')
-rw-r--r-- | klippy/cartesian.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/klippy/cartesian.py b/klippy/cartesian.py index ee27f7b3..10c5b5f2 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -9,20 +9,23 @@ import stepper, homing StepList = (0, 1, 2) class CartKinematics: - 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']] + 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): for i in StepList: self.steppers[i].mcu_stepper.set_position(newpos[i]) |