From 351b56572894a8dbffc00daf380f6037c98f0aa5 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 28 Oct 2019 23:09:25 -0400 Subject: [PATCH] delta: Convert step generation to use trapq system Signed-off-by: Kevin O'Connor --- klippy/chelper/kin_delta.c | 3 ++- klippy/kinematics/delta.py | 18 +++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/klippy/chelper/kin_delta.c b/klippy/chelper/kin_delta.c index 5ead7e98..1cfb1c35 100644 --- a/klippy/chelper/kin_delta.c +++ b/klippy/chelper/kin_delta.c @@ -1,6 +1,6 @@ // Delta kinematics stepper pulse time generation // -// Copyright (C) 2018 Kevin O'Connor +// Copyright (C) 2018-2019 Kevin O'Connor // // This file may be distributed under the terms of the GNU GPLv3 license. @@ -36,5 +36,6 @@ delta_stepper_alloc(double arm2, double tower_x, double tower_y) ds->tower_x = tower_x; ds->tower_y = tower_y; ds->sk.calc_position_cb = delta_stepper_calc_position; + ds->sk.active_flags = AF_X | AF_Y | AF_Z; return &ds->sk; } diff --git a/klippy/kinematics/delta.py b/klippy/kinematics/delta.py index 277d1147..f1892c1f 100644 --- a/klippy/kinematics/delta.py +++ b/klippy/kinematics/delta.py @@ -1,6 +1,6 @@ # Code for handling the kinematics of linear delta robots # -# Copyright (C) 2016-2018 Kevin O'Connor +# Copyright (C) 2016-2019 Kevin O'Connor # # This file may be distributed under the terms of the GNU GPLv3 license. import math, logging @@ -51,8 +51,11 @@ class DeltaKinematics: for angle in self.angles] for r, a, t in zip(self.rails, self.arm2, self.towers): r.setup_itersolve('delta_stepper_alloc', a, t[0], t[1]) + for s in self.get_steppers(): + s.set_trapq(toolhead.get_trapq()) + toolhead.register_move_handler(s.generate_steps) # Setup boundary checks - self.need_motor_enable = self.need_home = True + self.need_home = True self.limit_xy2 = -1. self.home_position = tuple( self._actuator_to_cartesian(self.abs_endstops)) @@ -106,11 +109,7 @@ class DeltaKinematics: self.limit_xy2 = -1. for rail in self.rails: rail.motor_enable(print_time, 0) - self.need_motor_enable = self.need_home = True - def _check_motor_enable(self, print_time): - for rail in self.rails: - rail.motor_enable(print_time, 1) - self.need_motor_enable = False + self.need_home = True def check_move(self, move): end_pos = move.end_pos end_xy2 = end_pos[0]**2 + end_pos[1]**2 @@ -146,10 +145,7 @@ class DeltaKinematics: limit_xy2 = -1. self.limit_xy2 = min(limit_xy2, self.slow_xy2) def move(self, print_time, move): - if self.need_motor_enable: - self._check_motor_enable(print_time) - for rail in self.rails: - rail.step_itersolve(move.cmove) + pass def get_status(self): return {'homed_axes': '' if self.need_home else 'XYZ'}