mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-18 04:08:04 -06:00
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:
parent
694d38c791
commit
b7f7b8a346
4 changed files with 34 additions and 22 deletions
|
@ -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)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue