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>
This commit is contained in:
Frans-willem Hardijzer 2024-02-07 20:25:36 +01:00 committed by KevinOConnor
parent 694d38c791
commit b7f7b8a346
4 changed files with 34 additions and 22 deletions

View file

@ -52,20 +52,27 @@ class CartKinematics:
def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
def calc_position(self, stepper_positions):
return [stepper_positions[rail.get_name()] for rail in self.rails]
rails = self.rails
if self.dc_module:
primary_rail = self.dc_module.get_primary_rail().get_rail()
rails = (rails[:self.dc_module.axis] +
[primary_rail] + rails[self.dc_module.axis+1:])
return [stepper_positions[rail.get_name()] for rail in rails]
def update_limits(self, i, range):
l, h = self.limits[i]
# Only update limits if this axis was already homed,
# otherwise leave in un-homed state.
if l <= h:
self.limits[i] = range
def override_rail(self, i, rail):
self.rails[i] = rail
def set_position(self, newpos, homing_axes):
for i, rail in enumerate(self.rails):
rail.set_position(newpos)
if i in homing_axes:
self.limits[i] = rail.get_range()
for axis in homing_axes:
if self.dc_module and axis == self.dc_module.axis:
rail = self.dc_module.get_primary_rail().get_rail()
else:
rail = self.rails[axis]
self.limits[axis] = rail.get_range()
def note_z_not_homed(self):
# Helper for Safe Z Home
self.limits[2] = (1.0, -1.0)