trapq: Remove move_fill()

Now that all callers use the trapq system to queue moves, it is no
longer necessary to individually allocate and fill a 'struct move'.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor
2019-10-29 12:44:39 -04:00
parent 797dcfcb12
commit 1acaaa98c2
9 changed files with 49 additions and 57 deletions

View File

@@ -23,10 +23,8 @@ class ManualStepper:
self.next_cmd_time = 0.
# Setup iterative solver
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_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves
self.stepper.setup_itersolve('cartesian_stepper_alloc', 'x')
self.stepper.set_trapq(self.trapq)
@@ -58,11 +56,10 @@ class ManualStepper:
dist = movepos - cp
accel_t, cruise_t, cruise_v = force_move.calc_move_time(
dist, speed, accel)
self.move_fill(self.cmove, self.next_cmd_time,
accel_t, cruise_t, accel_t,
cp, 0., 0., dist, 0., 0.,
0., cruise_v, accel)
self.trapq_add_move(self.trapq, self.cmove)
self.trapq_append(self.trapq, self.next_cmd_time,
accel_t, cruise_t, accel_t,
cp, 0., 0., dist, 0., 0.,
0., cruise_v, accel)
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)