Skip to content

Commit

Permalink
added dual_carriage flags in each kinematic type, added check for com…
Browse files Browse the repository at this point in the history
…patibility in toolhead.py (#146)
  • Loading branch information
lraithel15133 authored Feb 3, 2024
1 parent 7758ac9 commit 6eb9a20
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions klippy/kinematics/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, toolhead, config):
self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.0)
self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0)
self.dc_module = None
self.supports_dual_carriage = True
if config.has_section("dual_carriage"):
dc_config = config.getsection("dual_carriage")
dc_axis = dc_config.getchoice("axis", {"x": "x", "y": "y"})
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/corexy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, toolhead, config):
ranges = [r.get_range() for r in self.rails]
self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.0)
self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0)
self.supports_dual_carriage = False

def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/corexz.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, toolhead, config):
ranges = [r.get_range() for r in self.rails]
self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.0)
self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0)
self.supports_dual_carriage = False

def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def ratio_to_xy(ratio):
self.axes_min = toolhead.Coord(-max_xy, -max_xy, self.min_z, 0.0)
self.axes_max = toolhead.Coord(max_xy, max_xy, self.max_z, 0.0)
self.set_position([0.0, 0.0, 0.0], ())
self.supports_dual_carriage = False

def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/deltesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def __init__(self, toolhead, config):
self.axes_max = toolhead.Coord(*[l[1] for l in self.limits], e=0.0)
self.homed_axis = [False] * 3
self.set_position([0.0, 0.0, 0.0], ())
self.supports_dual_carriage = False

def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/hybrid_corexy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, toolhead, config):
self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.0)
self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0)
self.dc_module = None
self.supports_dual_carriage = True
if config.has_section("dual_carriage"):
dc_config = config.getsection("dual_carriage")
# dummy for cartesian config users
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/hybrid_corexz.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self, toolhead, config):
self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.0)
self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.0)
self.dc_module = None
self.supports_dual_carriage = True
if config.has_section("dual_carriage"):
dc_config = config.getsection("dual_carriage")
# dummy for cartesian config users
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/limited_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(self, toolhead, config):
self.cmd_SET_KINEMATICS_LIMIT,
desc=self.cmd_SET_KINEMATICS_LIMIT_help,
)
self.supports_dual_carriage = False

cmd_SET_KINEMATICS_LIMIT_help = "Set/get cartesian per axis velocity limits"

Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/limited_corexy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, toolhead, config):
self.cmd_SET_KINEMATICS_LIMIT,
desc=self.cmd_SET_KINEMATICS_LIMIT_help,
)
self.supports_dual_carriage = False

cmd_SET_KINEMATICS_LIMIT_help = "Set/get CoreXY per axis velocity limits"

Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/none.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class NoneKinematics:
def __init__(self, toolhead, config):
self.axes_minmax = toolhead.Coord(0.0, 0.0, 0.0, 0.0)
self.supports_dual_carriage = False

def get_steppers(self):
return []
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, toolhead, config):
min_z, max_z = self.rails[1].get_range()
self.axes_min = toolhead.Coord(-max_xy, -max_xy, min_z, 0.0)
self.axes_max = toolhead.Coord(max_xy, max_xy, max_z, 0.0)
self.supports_dual_carriage = False

def get_steppers(self):
return list(self.steppers)
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/rotary_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(self, toolhead, config):
self.axes_min = toolhead.Coord(-max_xy, -max_xy, self.min_z, 0.0)
self.axes_max = toolhead.Coord(max_xy, max_xy, self.max_z, 0.0)
self.set_position([0.0, 0.0, 0.0], ())
self.supports_dual_carriage = False

def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
Expand Down
1 change: 1 addition & 0 deletions klippy/kinematics/winch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, toolhead, config):
self.axes_min = toolhead.Coord(*[min(a) for a in acoords], e=0.0)
self.axes_max = toolhead.Coord(*[max(a) for a in acoords], e=0.0)
self.set_position([0.0, 0.0, 0.0], ())
self.supports_dual_carriage = False

def get_steppers(self):
return list(self.steppers)
Expand Down
8 changes: 8 additions & 0 deletions klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ def __init__(self, config):
msg = "Error loading kinematics '%s'" % (kin_name,)
logging.exception(msg)
raise config.error(msg)
if (
config.has_section("dual_carriage")
and not self.kin.supports_dual_carriage
):
raise config.error(
"dual_carriage not compatible with '%s' kinematics system"
% (kin_name,)
)
# Register commands
gcode.register_command("G4", self.cmd_G4)
gcode.register_command("M400", self.cmd_M400)
Expand Down

0 comments on commit 6eb9a20

Please sign in to comment.