trapq: Rename trapq_free_moves() to trapq_finalize_moves()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-07-19 11:12:58 -04:00
parent d1b41ea4a1
commit e2f483aea3
7 changed files with 14 additions and 14 deletions

View File

@ -75,7 +75,7 @@ defs_trapq = """
, double start_v, double cruise_v, double accel);
struct trapq *trapq_alloc(void);
void trapq_free(struct trapq *tq);
void trapq_free_moves(struct trapq *tq, double print_time);
void trapq_finalize_moves(struct trapq *tq, double print_time);
"""
defs_kin_cartesian = """

View File

@ -157,9 +157,9 @@ trapq_add_move(struct trapq *tq, struct move *m)
tail_sentinel->print_time = 0.;
}
// Free any moves older than `print_time` from the trapezoid velocity queue
// Expire any moves older than `print_time` from the trapezoid velocity queue
void __visible
trapq_free_moves(struct trapq *tq, double print_time)
trapq_finalize_moves(struct trapq *tq, double print_time)
{
struct move *head_sentinel = list_first_entry(&tq->moves, struct move,node);
struct move *tail_sentinel = list_last_entry(&tq->moves, struct move, node);

View File

@ -36,6 +36,6 @@ struct trapq *trapq_alloc(void);
void trapq_free(struct trapq *tq);
void trapq_check_sentinels(struct trapq *tq);
void trapq_add_move(struct trapq *tq, struct move *m);
void trapq_free_moves(struct trapq *tq, double print_time);
void trapq_finalize_moves(struct trapq *tq, double print_time);
#endif // trapq.h

View File

@ -36,7 +36,7 @@ class ForceMove:
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.stepper_kinematics = ffi_main.gc(
ffi_lib.cartesian_stepper_alloc('x'), ffi_lib.free)
# Register commands
@ -87,7 +87,7 @@ class ForceMove:
0., 0., 0., axis_r, 0., 0., 0., cruise_v, accel)
print_time = print_time + accel_t + cruise_t + accel_t
stepper.generate_steps(print_time)
self.trapq_free_moves(self.trapq, print_time + 99999.9)
self.trapq_finalize_moves(self.trapq, print_time + 99999.9)
stepper.set_trapq(prev_trapq)
stepper.set_stepper_kinematics(prev_sk)
toolhead.note_kinematic_activity(print_time)

View File

@ -25,7 +25,7 @@ class ManualStepper:
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.rail.setup_itersolve('cartesian_stepper_alloc', 'x')
self.rail.set_trapq(self.trapq)
# Register commands
@ -67,7 +67,7 @@ class ManualStepper:
0., cruise_v, accel)
self.next_cmd_time = self.next_cmd_time + accel_t + cruise_t + accel_t
self.rail.generate_steps(self.next_cmd_time)
self.trapq_free_moves(self.trapq, self.next_cmd_time + 99999.9)
self.trapq_finalize_moves(self.trapq, self.next_cmd_time + 99999.9)
toolhead = self.printer.lookup_object('toolhead')
toolhead.note_kinematic_activity(self.next_cmd_time)
if sync:

View File

@ -48,7 +48,7 @@ class PrinterExtruder:
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.sk_extruder = ffi_main.gc(ffi_lib.extruder_stepper_alloc(),
ffi_lib.free)
self.stepper.set_stepper_kinematics(self.sk_extruder)
@ -75,7 +75,7 @@ class PrinterExtruder:
self.name, self.cmd_SET_E_STEP_DISTANCE,
desc=self.cmd_SET_E_STEP_DISTANCE_help)
def update_move_time(self, flush_time):
self.trapq_free_moves(self.trapq, flush_time)
self.trapq_finalize_moves(self.trapq, flush_time)
def _set_pressure_advance(self, pressure_advance, smooth_time):
old_smooth_time = self.pressure_advance_smooth_time
if not self.pressure_advance:

View File

@ -244,7 +244,7 @@ class ToolHead:
ffi_main, ffi_lib = chelper.get_ffi()
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves
self.trapq_finalize_moves = ffi_lib.trapq_finalize_moves
self.step_generators = []
# Create kinematics class
gcode = self.printer.lookup_object('gcode')
@ -285,7 +285,7 @@ class ToolHead:
for sg in self.step_generators:
sg(sg_flush_time)
free_time = max(lkft, sg_flush_time - kin_flush_delay)
self.trapq_free_moves(self.trapq, free_time)
self.trapq_finalize_moves(self.trapq, free_time)
self.extruder.update_move_time(free_time)
mcu_flush_time = max(lkft, sg_flush_time - self.move_flush_time)
for m in self.all_mcus:
@ -401,7 +401,7 @@ class ToolHead:
return list(self.commanded_pos)
def set_position(self, newpos, homing_axes=()):
self.flush_step_generation()
self.trapq_free_moves(self.trapq, self.reactor.NEVER)
self.trapq_finalize_moves(self.trapq, self.reactor.NEVER)
self.commanded_pos[:] = newpos
self.kin.set_position(newpos, homing_axes)
self.printer.send_event("toolhead:set_position")
@ -477,7 +477,7 @@ class ToolHead:
self.move_queue.flush()
except DripModeEndSignal as e:
self.move_queue.reset()
self.trapq_free_moves(self.trapq, self.reactor.NEVER)
self.trapq_finalize_moves(self.trapq, self.reactor.NEVER)
# Exit "Drip" state
self.flush_step_generation()
# Misc commands