toolhead: Rename register_move_handler() to register_step_generator()

Rename the function so it is more clear what the step generation code
path is.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-11-07 10:59:35 -05:00
parent 72735b4552
commit 5500538fc5
7 changed files with 13 additions and 13 deletions

View File

@ -16,7 +16,7 @@ class CartKinematics:
rail.setup_itersolve('cartesian_stepper_alloc', axis) rail.setup_itersolve('cartesian_stepper_alloc', axis)
for s in self.get_steppers(): for s in self.get_steppers():
s.set_trapq(toolhead.get_trapq()) s.set_trapq(toolhead.get_trapq())
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
# Setup boundary checks # Setup boundary checks
max_velocity, max_accel = toolhead.get_max_velocity() max_velocity, max_accel = toolhead.get_max_velocity()
self.max_z_velocity = config.getfloat( self.max_z_velocity = config.getfloat(
@ -40,7 +40,7 @@ class CartKinematics:
dc_rail = stepper.LookupMultiRail(dc_config) dc_rail = stepper.LookupMultiRail(dc_config)
dc_rail.setup_itersolve('cartesian_stepper_alloc', dc_axis) dc_rail.setup_itersolve('cartesian_stepper_alloc', dc_axis)
for s in dc_rail.get_steppers(): for s in dc_rail.get_steppers():
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
dc_rail.set_max_jerk(max_halt_velocity, max_accel) dc_rail.set_max_jerk(max_halt_velocity, max_accel)
self.dual_carriage_rails = [ self.dual_carriage_rails = [
self.rails[self.dual_carriage_axis], dc_rail] self.rails[self.dual_carriage_axis], dc_rail]

View File

@ -19,7 +19,7 @@ class CoreXYKinematics:
self.rails[2].setup_itersolve('cartesian_stepper_alloc', 'z') self.rails[2].setup_itersolve('cartesian_stepper_alloc', 'z')
for s in self.get_steppers(): for s in self.get_steppers():
s.set_trapq(toolhead.get_trapq()) s.set_trapq(toolhead.get_trapq())
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
# Setup boundary checks # Setup boundary checks
max_velocity, max_accel = toolhead.get_max_velocity() max_velocity, max_accel = toolhead.get_max_velocity()
self.max_z_velocity = config.getfloat( self.max_z_velocity = config.getfloat(

View File

@ -53,7 +53,7 @@ class DeltaKinematics:
r.setup_itersolve('delta_stepper_alloc', a, t[0], t[1]) r.setup_itersolve('delta_stepper_alloc', a, t[0], t[1])
for s in self.get_steppers(): for s in self.get_steppers():
s.set_trapq(toolhead.get_trapq()) s.set_trapq(toolhead.get_trapq())
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
# Setup boundary checks # Setup boundary checks
self.need_home = True self.need_home = True
self.limit_xy2 = -1. self.limit_xy2 = -1.

View File

@ -58,8 +58,8 @@ class PrinterExtruder:
self.trapq_free_moves = ffi_lib.trapq_free_moves self.trapq_free_moves = ffi_lib.trapq_free_moves
self.stepper.setup_itersolve('extruder_stepper_alloc') self.stepper.setup_itersolve('extruder_stepper_alloc')
self.stepper.set_trapq(self.trapq) self.stepper.set_trapq(self.trapq)
toolhead.register_move_handler(self.stepper.generate_steps) toolhead.register_step_generator(self.stepper.generate_steps)
toolhead.register_move_handler(self._free_moves) toolhead.register_step_generator(self._free_moves)
# Setup SET_PRESSURE_ADVANCE command # Setup SET_PRESSURE_ADVANCE command
gcode = self.printer.lookup_object('gcode') gcode = self.printer.lookup_object('gcode')
if self.name in ('extruder', 'extruder0'): if self.name in ('extruder', 'extruder0'):

View File

@ -20,7 +20,7 @@ class PolarKinematics:
for s in r.get_steppers() ] for s in r.get_steppers() ]
for s in self.get_steppers(): for s in self.get_steppers():
s.set_trapq(toolhead.get_trapq()) s.set_trapq(toolhead.get_trapq())
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
# Setup boundary checks # Setup boundary checks
max_velocity, max_accel = toolhead.get_max_velocity() max_velocity, max_accel = toolhead.get_max_velocity()
self.max_z_velocity = config.getfloat( self.max_z_velocity = config.getfloat(

View File

@ -21,7 +21,7 @@ class WinchKinematics:
self.anchors.append(a) self.anchors.append(a)
s.setup_itersolve('winch_stepper_alloc', *a) s.setup_itersolve('winch_stepper_alloc', *a)
s.set_trapq(toolhead.get_trapq()) s.set_trapq(toolhead.get_trapq())
toolhead.register_move_handler(s.generate_steps) toolhead.register_step_generator(s.generate_steps)
# Setup stepper max halt velocity # Setup stepper max halt velocity
max_velocity, max_accel = toolhead.get_max_velocity() max_velocity, max_accel = toolhead.get_max_velocity()
max_halt_velocity = toolhead.get_max_axis_halt() max_halt_velocity = toolhead.get_max_axis_halt()

View File

@ -240,7 +240,7 @@ class ToolHead:
self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free) self.trapq = ffi_main.gc(ffi_lib.trapq_alloc(), ffi_lib.trapq_free)
self.trapq_append = ffi_lib.trapq_append self.trapq_append = ffi_lib.trapq_append
self.trapq_free_moves = ffi_lib.trapq_free_moves self.trapq_free_moves = ffi_lib.trapq_free_moves
self.move_handlers = [] self.step_generators = []
# Create kinematics class # Create kinematics class
self.extruder = kinematics.extruder.DummyExtruder() self.extruder = kinematics.extruder.DummyExtruder()
self.move_queue.set_extruder(self.extruder) self.move_queue.set_extruder(self.extruder)
@ -273,8 +273,8 @@ class ToolHead:
while 1: while 1:
flush_to_time = min(self.print_time + batch_time, next_print_time) flush_to_time = min(self.print_time + batch_time, next_print_time)
self.print_time = flush_to_time self.print_time = flush_to_time
for mh in self.move_handlers: for sg in self.step_generators:
mh(flush_to_time) sg(flush_to_time)
self.trapq_free_moves(self.trapq, flush_to_time) self.trapq_free_moves(self.trapq, flush_to_time)
if lazy: if lazy:
flush_to_time -= self.move_flush_time flush_to_time -= self.move_flush_time
@ -498,8 +498,8 @@ class ToolHead:
return self.kin return self.kin
def get_trapq(self): def get_trapq(self):
return self.trapq return self.trapq
def register_move_handler(self, handler): def register_step_generator(self, handler):
self.move_handlers.append(handler) self.step_generators.append(handler)
def get_max_velocity(self): def get_max_velocity(self):
return self.max_velocity, self.max_accel return self.max_velocity, self.max_accel
def get_max_axis_halt(self): def get_max_axis_halt(self):