delta: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b792e0fdd1
commit
351b565728
|
@ -1,6 +1,6 @@
|
|||
// Delta kinematics stepper pulse time generation
|
||||
//
|
||||
// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
// Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Code for handling the kinematics of linear delta robots
|
||||
#
|
||||
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# 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'}
|
||||
|
||||
|
|
Loading…
Reference in New Issue