aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/force_move.py7
-rw-r--r--klippy/extras/safe_z_home.py2
-rw-r--r--klippy/extras/stepper_enable.py2
-rw-r--r--klippy/kinematics/cartesian.py8
-rw-r--r--klippy/kinematics/corexy.py8
-rw-r--r--klippy/kinematics/corexz.py8
-rw-r--r--klippy/kinematics/delta.py4
-rw-r--r--klippy/kinematics/deltesian.py8
-rw-r--r--klippy/kinematics/hybrid_corexy.py8
-rw-r--r--klippy/kinematics/hybrid_corexz.py8
-rw-r--r--klippy/kinematics/none.py2
-rw-r--r--klippy/kinematics/polar.py6
-rw-r--r--klippy/kinematics/rotary_delta.py4
-rw-r--r--klippy/kinematics/winch.py2
14 files changed, 38 insertions, 39 deletions
diff --git a/klippy/extras/force_move.py b/klippy/extras/force_move.py
index 0b2187fd..24783c2c 100644
--- a/klippy/extras/force_move.py
+++ b/klippy/extras/force_move.py
@@ -131,11 +131,10 @@ class ForceMove:
x = gcmd.get_float('X', curpos[0])
y = gcmd.get_float('Y', curpos[1])
z = gcmd.get_float('Z', curpos[2])
- clear = gcmd.get('CLEAR', '').upper()
- axes = ['X', 'Y', 'Z']
- clear_axes = [axes.index(a) for a in axes if a in clear]
+ clear = gcmd.get('CLEAR', '').lower()
+ clear_axes = "".join([a for a in "xyz" if a in clear])
logging.info("SET_KINEMATIC_POSITION pos=%.3f,%.3f,%.3f clear=%s",
- x, y, z, ','.join((axes[i] for i in clear_axes)))
+ x, y, z, clear_axes)
toolhead.set_position([x, y, z, curpos[3]], homing_axes="xyz")
toolhead.get_kinematics().clear_homing_state(clear_axes)
diff --git a/klippy/extras/safe_z_home.py b/klippy/extras/safe_z_home.py
index 3ebaa13e..32b515b9 100644
--- a/klippy/extras/safe_z_home.py
+++ b/klippy/extras/safe_z_home.py
@@ -40,7 +40,7 @@ class SafeZHoming:
toolhead.set_position(pos, homing_axes="z")
toolhead.manual_move([None, None, self.z_hop],
self.z_hop_speed)
- toolhead.get_kinematics().clear_homing_state((2,))
+ toolhead.get_kinematics().clear_homing_state("z")
elif pos[2] < self.z_hop:
# If the Z axis is homed, and below z_hop, lift it to z_hop
toolhead.manual_move([None, None, self.z_hop],
diff --git a/klippy/extras/stepper_enable.py b/klippy/extras/stepper_enable.py
index 4e8f3bbb..2bad7555 100644
--- a/klippy/extras/stepper_enable.py
+++ b/klippy/extras/stepper_enable.py
@@ -94,7 +94,7 @@ class PrinterStepperEnable:
print_time = toolhead.get_last_move_time()
for el in self.enable_lines.values():
el.motor_disable(print_time)
- toolhead.get_kinematics().clear_homing_state((0, 1, 2))
+ toolhead.get_kinematics().clear_homing_state("xyz")
self.printer.send_event("stepper_enable:motor_off", print_time)
toolhead.dwell(DISABLE_STALL_TIME)
def motor_debug_enable(self, stepper, enable):
diff --git a/klippy/kinematics/cartesian.py b/klippy/kinematics/cartesian.py
index 0c22172b..2a50a05d 100644
--- a/klippy/kinematics/cartesian.py
+++ b/klippy/kinematics/cartesian.py
@@ -72,10 +72,10 @@ class CartKinematics:
else:
rail = self.rails[axis]
self.limits[axis] = rail.get_range()
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.limits[i] = (1.0, -1.0)
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.limits[axis] = (1.0, -1.0)
def home_axis(self, homing_state, axis, rail):
# Determine movement
position_min, position_max = rail.get_range()
diff --git a/klippy/kinematics/corexy.py b/klippy/kinematics/corexy.py
index 891e58e0..d68f8854 100644
--- a/klippy/kinematics/corexy.py
+++ b/klippy/kinematics/corexy.py
@@ -41,10 +41,10 @@ class CoreXYKinematics:
rail.set_position(newpos)
if "xyz"[i] in homing_axes:
self.limits[i] = rail.get_range()
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.limits[i] = (1.0, -1.0)
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.limits[axis] = (1.0, -1.0)
def home(self, homing_state):
# Each axis is homed independently and in order
for axis in homing_state.get_axes():
diff --git a/klippy/kinematics/corexz.py b/klippy/kinematics/corexz.py
index 34def72a..8d3e027c 100644
--- a/klippy/kinematics/corexz.py
+++ b/klippy/kinematics/corexz.py
@@ -41,10 +41,10 @@ class CoreXZKinematics:
rail.set_position(newpos)
if "xyz"[i] in homing_axes:
self.limits[i] = rail.get_range()
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.limits[i] = (1.0, -1.0)
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.limits[axis] = (1.0, -1.0)
def home(self, homing_state):
# Each axis is homed independently and in order
for axis in homing_state.get_axes():
diff --git a/klippy/kinematics/delta.py b/klippy/kinematics/delta.py
index beb1826f..aa244a8f 100644
--- a/klippy/kinematics/delta.py
+++ b/klippy/kinematics/delta.py
@@ -103,9 +103,9 @@ class DeltaKinematics:
self.limit_xy2 = -1.
if homing_axes == "xyz":
self.need_home = False
- def clear_homing_state(self, axes):
+ def clear_homing_state(self, clear_axes):
# Clearing homing state for each axis individually is not implemented
- if 0 in axes or 1 in axes or 2 in axes:
+ if clear_axes:
self.limit_xy2 = -1
self.need_home = True
def home(self, homing_state):
diff --git a/klippy/kinematics/deltesian.py b/klippy/kinematics/deltesian.py
index e0118b34..1f7ddaa0 100644
--- a/klippy/kinematics/deltesian.py
+++ b/klippy/kinematics/deltesian.py
@@ -116,10 +116,10 @@ class DeltesianKinematics:
for axis_name in homing_axes:
axis = "xyz".index(axis_name)
self.homed_axis[axis] = True
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.homed_axis[i] = False
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.homed_axis[axis] = False
def home(self, homing_state):
homing_axes = homing_state.get_axes()
home_xz = 0 in homing_axes or 2 in homing_axes
diff --git a/klippy/kinematics/hybrid_corexy.py b/klippy/kinematics/hybrid_corexy.py
index 6d72a89c..fbaf49e4 100644
--- a/klippy/kinematics/hybrid_corexy.py
+++ b/klippy/kinematics/hybrid_corexy.py
@@ -74,10 +74,10 @@ class HybridCoreXYKinematics:
else:
rail = self.rails[axis]
self.limits[axis] = rail.get_range()
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.limits[i] = (1.0, -1.0)
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.limits[axis] = (1.0, -1.0)
def home_axis(self, homing_state, axis, rail):
position_min, position_max = rail.get_range()
hi = rail.get_homing_info()
diff --git a/klippy/kinematics/hybrid_corexz.py b/klippy/kinematics/hybrid_corexz.py
index 05fe096e..6fa120f7 100644
--- a/klippy/kinematics/hybrid_corexz.py
+++ b/klippy/kinematics/hybrid_corexz.py
@@ -74,10 +74,10 @@ class HybridCoreXZKinematics:
else:
rail = self.rails[axis]
self.limits[axis] = rail.get_range()
- def clear_homing_state(self, axes):
- for i, _ in enumerate(self.limits):
- if i in axes:
- self.limits[i] = (1.0, -1.0)
+ def clear_homing_state(self, clear_axes):
+ for axis, axis_name in enumerate("xyz"):
+ if axis_name in clear_axes:
+ self.limits[axis] = (1.0, -1.0)
def home_axis(self, homing_state, axis, rail):
position_min, position_max = rail.get_range()
hi = rail.get_homing_info()
diff --git a/klippy/kinematics/none.py b/klippy/kinematics/none.py
index fda1f073..d9f9d21d 100644
--- a/klippy/kinematics/none.py
+++ b/klippy/kinematics/none.py
@@ -13,7 +13,7 @@ class NoneKinematics:
return [0, 0, 0]
def set_position(self, newpos, homing_axes):
pass
- def clear_homing_state(self, axes):
+ def clear_homing_state(self, clear_axes):
pass
def home(self, homing_state):
pass
diff --git a/klippy/kinematics/polar.py b/klippy/kinematics/polar.py
index 548b4bac..73967c29 100644
--- a/klippy/kinematics/polar.py
+++ b/klippy/kinematics/polar.py
@@ -49,11 +49,11 @@ class PolarKinematics:
self.limit_z = self.rails[1].get_range()
if "x" in homing_axes and "y" in homing_axes:
self.limit_xy2 = self.rails[0].get_range()[1]**2
- def clear_homing_state(self, axes):
- if 0 in axes or 1 in axes:
+ def clear_homing_state(self, clear_axes):
+ if "x" in clear_axes or "y" in clear_axes:
# X and Y cannot be cleared separately
self.limit_xy2 = -1.
- if 2 in axes:
+ if "z" in clear_axes:
self.limit_z = (1.0, -1.0)
def _home_axis(self, homing_state, axis, rail):
# Determine movement
diff --git a/klippy/kinematics/rotary_delta.py b/klippy/kinematics/rotary_delta.py
index 6b457ccb..35f7ca98 100644
--- a/klippy/kinematics/rotary_delta.py
+++ b/klippy/kinematics/rotary_delta.py
@@ -86,9 +86,9 @@ class RotaryDeltaKinematics:
self.limit_xy2 = -1.
if homing_axes == "xyz":
self.need_home = False
- def clear_homing_state(self, axes):
+ def clear_homing_state(self, clear_axes):
# Clearing homing state for each axis individually is not implemented
- if 0 in axes or 1 in axes or 2 in axes:
+ if clear_axes:
self.limit_xy2 = -1
self.need_home = True
def home(self, homing_state):
diff --git a/klippy/kinematics/winch.py b/klippy/kinematics/winch.py
index 0003826b..47bc6855 100644
--- a/klippy/kinematics/winch.py
+++ b/klippy/kinematics/winch.py
@@ -36,7 +36,7 @@ class WinchKinematics:
def set_position(self, newpos, homing_axes):
for s in self.steppers:
s.set_position(newpos)
- def clear_homing_state(self, axes):
+ def clear_homing_state(self, clear_axes):
# XXX - homing not implemented
pass
def home(self, homing_state):