From a31c31aed43a6852880ec3e47f0621c811b0e2d0 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 13 Jul 2018 11:24:36 -0400 Subject: mcu: Enhance itersolve stepper kinematics allocation Allocate the stepper_kinematics directly in mcu.py - that way the kinematic classes don't have to interact with the chelper code. Signed-off-by: Kevin O'Connor --- klippy/kinematics/corexy.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'klippy/kinematics/corexy.py') diff --git a/klippy/kinematics/corexy.py b/klippy/kinematics/corexy.py index 259a6eeb..46d8def3 100644 --- a/klippy/kinematics/corexy.py +++ b/klippy/kinematics/corexy.py @@ -4,15 +4,20 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. import logging, math -import stepper, homing, chelper +import stepper, homing class CoreXYKinematics: def __init__(self, toolhead, config): + # Setup axis rails self.rails = [ stepper.PrinterRail(config.getsection('stepper_x')), stepper.PrinterRail(config.getsection('stepper_y')), stepper.LookupMultiRail(config.getsection('stepper_z')) ] self.rails[0].add_to_endstop(self.rails[1].get_endstops()[0][0]) self.rails[1].add_to_endstop(self.rails[0].get_endstops()[0][0]) + self.rails[0].setup_itersolve('corexy_stepper_alloc', '+') + self.rails[1].setup_itersolve('corexy_stepper_alloc', '-') + self.rails[2].setup_itersolve('cartesian_stepper_alloc', 'z') + # Setup boundary checks max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( 'max_z_velocity', max_velocity, above=0., maxval=max_velocity) @@ -20,13 +25,6 @@ class CoreXYKinematics: 'max_z_accel', max_accel, above=0., maxval=max_accel) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 - # Setup iterative solver - ffi_main, ffi_lib = chelper.get_ffi() - self.rails[0].setup_itersolve(ffi_main.gc( - ffi_lib.corexy_stepper_alloc('+'), ffi_lib.free)) - self.rails[1].setup_itersolve(ffi_main.gc( - ffi_lib.corexy_stepper_alloc('-'), ffi_lib.free)) - self.rails[2].setup_cartesian_itersolve('z') # Setup stepper max halt velocity max_halt_velocity = toolhead.get_max_axis_halt() max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.) -- cgit v1.2.3-70-g09d2