aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/kinematics/idex_modes.py
diff options
context:
space:
mode:
authorFrans-willem Hardijzer <fw@hardijzer.nl>2024-02-07 20:25:36 +0100
committerKevinOConnor <kevin@koconnor.net>2024-05-16 12:08:13 -0400
commitb7f7b8a346388cc32d80b6e6f60e5fdb4cbd3ce6 (patch)
tree5952b984887e0b6ce6aa7bb8f74eedb436518f3f /klippy/kinematics/idex_modes.py
parent694d38c79105f2d33242487faa0532d1291ee7b6 (diff)
downloadkutter-b7f7b8a346388cc32d80b6e6f60e5fdb4cbd3ce6.tar.gz
kutter-b7f7b8a346388cc32d80b6e6f60e5fdb4cbd3ce6.tar.xz
kutter-b7f7b8a346388cc32d80b6e6f60e5fdb4cbd3ce6.zip
idex_modes: Bugfix for kinematic position calculation.
idex_mode would swap the X and dual-carriage rail in some cases (homing), but not in others. As such, the position calculation was correct while homing, but incorrect for the second carriage during normal moves. This commit fixes homing to work without swapped rails, removes the swapping of rails while homing, and removes the ability to swap rails (as it is now no longer used). Fix has been tested in a Hybrid_CoreXY IDEX printer (Voron Double Dragon). Hybrid_CoreXZ has identical changes and is similar enough that I am confident it will work as intended. Changes to cartesion seem simple enough, but would benefit from someone running a couple of tests. Signed-off-by: Frans-Willem Hardijzer <fw@hardijzer.nl>
Diffstat (limited to 'klippy/kinematics/idex_modes.py')
-rw-r--r--klippy/kinematics/idex_modes.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/klippy/kinematics/idex_modes.py b/klippy/kinematics/idex_modes.py
index 2ce91afe..f2618d08 100644
--- a/klippy/kinematics/idex_modes.py
+++ b/klippy/kinematics/idex_modes.py
@@ -42,7 +42,12 @@ class DualCarriages:
desc=self.cmd_RESTORE_DUAL_CARRIAGE_STATE_help)
def get_rails(self):
return self.dc
- def toggle_active_dc_rail(self, index, override_rail=False):
+ def get_primary_rail(self):
+ for rail in self.dc:
+ if rail.mode == PRIMARY:
+ return rail
+ return None
+ def toggle_active_dc_rail(self, index):
toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation()
pos = toolhead.get_position()
@@ -52,15 +57,11 @@ class DualCarriages:
if i != index:
if dc.is_active():
dc.inactivate(pos)
- if override_rail:
- kin.override_rail(3, dc_rail)
target_dc = self.dc[index]
if target_dc.mode != PRIMARY:
newpos = pos[:self.axis] + [target_dc.get_axis_position(pos)] \
+ pos[self.axis+1:]
target_dc.activate(PRIMARY, newpos, old_position=pos)
- if override_rail:
- kin.override_rail(self.axis, target_dc.get_rail())
toolhead.set_position(newpos)
kin.update_limits(self.axis, target_dc.get_rail().get_range())
def home(self, homing_state):
@@ -72,10 +73,10 @@ class DualCarriages:
# the same direction and the first carriage homes on the second one
enumerated_dcs.reverse()
for i, dc_rail in enumerated_dcs:
- self.toggle_active_dc_rail(i, override_rail=True)
+ self.toggle_active_dc_rail(i)
kin.home_axis(homing_state, self.axis, dc_rail.get_rail())
# Restore the original rails ordering
- self.toggle_active_dc_rail(0, override_rail=True)
+ self.toggle_active_dc_rail(0)
def get_status(self, eventtime=None):
return {('carriage_%d' % (i,)) : dc.mode
for (i, dc) in enumerate(self.dc)}