diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-01-08 11:52:28 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-01-08 11:52:28 -0500 |
commit | c8434ec54b0517503af4aeee9016783d508118b0 (patch) | |
tree | 7229f2ea5c4f63a7fad9c46ef6f84adc614b96fa /klippy/kinematics/corexz.py | |
parent | f79187d726d00c7215448e5953cdb0dd8d490683 (diff) | |
download | kutter-c8434ec54b0517503af4aeee9016783d508118b0.tar.gz kutter-c8434ec54b0517503af4aeee9016783d508118b0.tar.xz kutter-c8434ec54b0517503af4aeee9016783d508118b0.zip |
kinematics: Calculate axis_minimum/axis_maximum in advance
Calculate the get_status() axis_minimum and axis_maximum fields in
advance so that they don't need to be calculated on each get_status()
call.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/kinematics/corexz.py')
-rw-r--r-- | klippy/kinematics/corexz.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/klippy/kinematics/corexz.py b/klippy/kinematics/corexz.py index 584cce59..2543977b 100644 --- a/klippy/kinematics/corexz.py +++ b/klippy/kinematics/corexz.py @@ -4,7 +4,7 @@ # # This file may be distributed under the terms of the GNU GPLv3 license. import logging, math -import stepper, homing +import stepper class CoreXZKinematics: def __init__(self, toolhead, config): @@ -31,6 +31,9 @@ class CoreXZKinematics: self.max_z_accel = config.getfloat( 'max_z_accel', max_accel, above=0., maxval=max_accel) self.limits = [(1.0, -1.0)] * 3 + ranges = [r.get_range() for r in self.rails] + self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.) + self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.) # Setup stepper max halt velocity max_halt_velocity = toolhead.get_max_axis_halt() max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.) @@ -94,14 +97,10 @@ class CoreXZKinematics: self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) def get_status(self, eventtime): axes = [a for a, (l, h) in zip("xyz", self.limits) if l <= h] - axes_min = [0.0, 0.0, 0.0, 0.0] - axes_max = [0.0, 0.0, 0.0, 0.0] - for pos, rail in enumerate(self.rails): - axes_min[pos], axes_max[pos] = rail.get_range() return { 'homed_axes': "".join(axes), - 'axis_minimum': homing.Coord(*axes_min), - 'axis_maximum': homing.Coord(*axes_max) + 'axis_minimum': self.axes_min, + 'axis_maximum': self.axes_max, } def load_kinematics(toolhead, config): |