manual_stepper: Convert step generation to use trapq system
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
9845d0d103
commit
e6f713f1ce
|
@ -25,7 +25,11 @@ class ManualStepper:
|
||||||
ffi_main, ffi_lib = chelper.get_ffi()
|
ffi_main, ffi_lib = chelper.get_ffi()
|
||||||
self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free)
|
self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free)
|
||||||
self.move_fill = ffi_lib.move_fill
|
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.setup_itersolve('cartesian_stepper_alloc', 'x')
|
||||||
|
self.stepper.set_trapq(self.trapq)
|
||||||
self.stepper.set_max_jerk(9999999.9, 9999999.9)
|
self.stepper.set_max_jerk(9999999.9, 9999999.9)
|
||||||
# Register commands
|
# Register commands
|
||||||
stepper_name = config.get_name().split()[1]
|
stepper_name = config.get_name().split()[1]
|
||||||
|
@ -58,8 +62,10 @@ class ManualStepper:
|
||||||
accel_t, cruise_t, accel_t,
|
accel_t, cruise_t, accel_t,
|
||||||
cp, 0., 0., dist, 0., 0.,
|
cp, 0., 0., dist, 0., 0.,
|
||||||
0., cruise_v, accel)
|
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.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()
|
self.sync_print_time()
|
||||||
def do_homing_move(self, movepos, speed, accel, triggered):
|
def do_homing_move(self, movepos, speed, accel, triggered):
|
||||||
if not self.can_home:
|
if not self.can_home:
|
||||||
|
@ -107,13 +113,9 @@ class ManualStepper:
|
||||||
accel = self.gcode.get_float('ACCEL', params, self.accel, minval=0.)
|
accel = self.gcode.get_float('ACCEL', params, self.accel, minval=0.)
|
||||||
if homing_move:
|
if homing_move:
|
||||||
movepos = self.gcode.get_float('MOVE', 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_homing_move(movepos, speed, accel, homing_move > 0)
|
self.do_homing_move(movepos, speed, accel, homing_move > 0)
|
||||||
elif 'MOVE' in params:
|
elif 'MOVE' in params:
|
||||||
movepos = self.gcode.get_float('MOVE', 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)
|
self.do_move(movepos, speed, accel)
|
||||||
def handle_motor_off(self, print_time):
|
def handle_motor_off(self, print_time):
|
||||||
self.do_enable(0)
|
self.do_enable(0)
|
||||||
|
|
Loading…
Reference in New Issue