diff --git a/klippy/extras/manual_stepper.py b/klippy/extras/manual_stepper.py index 7cbbe806..a8448e72 100644 --- a/klippy/extras/manual_stepper.py +++ b/klippy/extras/manual_stepper.py @@ -25,7 +25,11 @@ class ManualStepper: 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.setup_itersolve('cartesian_stepper_alloc', 'x') + self.stepper.set_trapq(self.trapq) self.stepper.set_max_jerk(9999999.9, 9999999.9) # Register commands stepper_name = config.get_name().split()[1] @@ -58,8 +62,10 @@ class ManualStepper: accel_t, cruise_t, accel_t, cp, 0., 0., dist, 0., 0., 0., cruise_v, accel) - self.stepper.step_itersolve(self.cmove) + self.trapq_add_move(self.trapq, self.cmove) self.next_cmd_time += accel_t + cruise_t + accel_t + self.stepper.generate_steps(self.next_cmd_time) + self.trapq_free_moves(self.trapq, self.next_cmd_time) self.sync_print_time() def do_homing_move(self, movepos, speed, accel, triggered): if not self.can_home: @@ -107,13 +113,9 @@ class ManualStepper: accel = self.gcode.get_float('ACCEL', params, self.accel, minval=0.) if homing_move: movepos = self.gcode.get_float('MOVE', params) - if 'ENABLE' not in params and not self.stepper.is_motor_enabled(): - self.do_enable(True) self.do_homing_move(movepos, speed, accel, homing_move > 0) elif 'MOVE' in params: movepos = self.gcode.get_float('MOVE', params) - if 'ENABLE' not in params and not self.stepper.is_motor_enabled(): - self.do_enable(True) self.do_move(movepos, speed, accel) def handle_motor_off(self, print_time): self.do_enable(0)