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>
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user