stepper: Make sure to reload trapq in set_stepper_kinematics()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-06-30 20:20:16 -04:00
parent 541665679e
commit c6b652044d
2 changed files with 5 additions and 3 deletions

View File

@ -39,7 +39,6 @@ class ForceMove:
self.trapq_free_moves = ffi_lib.trapq_free_moves self.trapq_free_moves = ffi_lib.trapq_free_moves
self.stepper_kinematics = ffi_main.gc( self.stepper_kinematics = ffi_main.gc(
ffi_lib.cartesian_stepper_alloc('x'), ffi_lib.free) ffi_lib.cartesian_stepper_alloc('x'), ffi_lib.free)
ffi_lib.itersolve_set_trapq(self.stepper_kinematics, self.trapq)
# Register commands # Register commands
gcode = self.printer.lookup_object('gcode') gcode = self.printer.lookup_object('gcode')
gcode.register_command('STEPPER_BUZZ', self.cmd_STEPPER_BUZZ, gcode.register_command('STEPPER_BUZZ', self.cmd_STEPPER_BUZZ,
@ -80,6 +79,7 @@ class ForceMove:
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation() toolhead.flush_step_generation()
prev_sk = stepper.set_stepper_kinematics(self.stepper_kinematics) prev_sk = stepper.set_stepper_kinematics(self.stepper_kinematics)
prev_trapq = stepper.set_trapq(self.trapq)
stepper.set_position((0., 0., 0.)) stepper.set_position((0., 0., 0.))
axis_r, accel_t, cruise_t, cruise_v = calc_move_time(dist, speed, accel) axis_r, accel_t, cruise_t, cruise_v = calc_move_time(dist, speed, accel)
print_time = toolhead.get_last_move_time() print_time = toolhead.get_last_move_time()
@ -88,6 +88,7 @@ class ForceMove:
print_time = print_time + accel_t + cruise_t + accel_t print_time = print_time + accel_t + cruise_t + accel_t
stepper.generate_steps(print_time) stepper.generate_steps(print_time)
self.trapq_free_moves(self.trapq, print_time + 99999.9) self.trapq_free_moves(self.trapq, print_time + 99999.9)
stepper.set_trapq(prev_trapq)
stepper.set_stepper_kinematics(prev_sk) stepper.set_stepper_kinematics(prev_sk)
toolhead.note_kinematic_activity(print_time) toolhead.note_kinematic_activity(print_time)
toolhead.dwell(accel_t + cruise_t + accel_t) toolhead.dwell(accel_t + cruise_t + accel_t)

View File

@ -124,8 +124,9 @@ class MCU_stepper:
old_sk = self._stepper_kinematics old_sk = self._stepper_kinematics
self._stepper_kinematics = sk self._stepper_kinematics = sk
if sk is not None: if sk is not None:
self._ffi_lib.itersolve_set_stepcompress( self._ffi_lib.itersolve_set_stepcompress(sk, self._stepqueue,
sk, self._stepqueue, self._step_dist) self._step_dist)
self.set_trapq(self._trapq)
return old_sk return old_sk
def note_homing_end(self, did_trigger=False): def note_homing_end(self, did_trigger=False):
ret = self._ffi_lib.stepcompress_reset(self._stepqueue, 0) ret = self._ffi_lib.stepcompress_reset(self._stepqueue, 0)