From ef53ded6bcad496d4506a9222c4db4ccb2c0418c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 29 Oct 2019 11:49:13 -0400 Subject: [PATCH] force_move: Convert step generation to use trapq system Signed-off-by: Kevin O'Connor --- klippy/extras/force_move.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py index 94628987..1c837e9d 100644 --- a/klippy/extras/force_move.py +++ b/klippy/extras/force_move.py @@ -1,6 +1,6 @@ # Utility for manually moving a stepper for diagnostic purposes # -# 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. import math, logging @@ -30,8 +30,12 @@ class ForceMove: ffi_main, ffi_lib = chelper.get_ffi() self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free) self.move_fill = ffi_lib.move_fill + self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free) + self.trapq_add_move = ffi_lib.trapq_add_move + self.trapq_free_moves = ffi_lib.trapq_free_moves self.stepper_kinematics = ffi_main.gc( ffi_lib.cartesian_stepper_alloc('x'), ffi_lib.free) + ffi_lib.itersolve_set_trapq(self.stepper_kinematics, self.trapq) # Register commands self.gcode = self.printer.lookup_object('gcode') self.gcode.register_command('STEPPER_BUZZ', self.cmd_STEPPER_BUZZ, @@ -70,7 +74,10 @@ class ForceMove: accel_t, cruise_t, cruise_v = calc_move_time(dist, speed, accel) self.move_fill(self.cmove, print_time, accel_t, cruise_t, accel_t, 0., 0., 0., dist, 0., 0., 0., cruise_v, accel) - stepper.step_itersolve(self.cmove) + self.trapq_add_move(self.trapq, self.cmove) + print_time += accel_t + cruise_t + accel_t + stepper.generate_steps(print_time) + self.trapq_free_moves(self.trapq, print_time) stepper.set_stepper_kinematics(prev_sk) toolhead.dwell(accel_t + cruise_t + accel_t) def _lookup_stepper(self, params):