aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/gcode_arcs.py
diff options
context:
space:
mode:
authorNick Douma <n.douma@nekoconeko.nl>2022-01-23 02:47:51 +0100
committerGitHub <noreply@github.com>2022-01-22 20:47:51 -0500
commit28b568a6ace40af5f92383d23797409f4c1bcce3 (patch)
treea361486e43c5a3e15c1baa88567a0c545d1e88b0 /klippy/extras/gcode_arcs.py
parent2f1edac9222d0a106ae533ebaf762d419861d586 (diff)
downloadkutter-28b568a6ace40af5f92383d23797409f4c1bcce3.tar.gz
kutter-28b568a6ace40af5f92383d23797409f4c1bcce3.tar.xz
kutter-28b568a6ace40af5f92383d23797409f4c1bcce3.zip
gcode_arcs: detect CW / CCW move with renamed G2/G3 command (#5096)
The G2 / G3 command might be renamed using `gcode_macro` + `rename_existing`. This change allow detecting clockwise / anti-clockwise moves when the command gets renamed. Signed-off-by: Nick Douma <n.douma@nekoconeko.nl>
Diffstat (limited to 'klippy/extras/gcode_arcs.py')
-rw-r--r--klippy/extras/gcode_arcs.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/klippy/extras/gcode_arcs.py b/klippy/extras/gcode_arcs.py
index 71f83ffb..61fa7234 100644
--- a/klippy/extras/gcode_arcs.py
+++ b/klippy/extras/gcode_arcs.py
@@ -20,9 +20,15 @@ class ArcSupport:
self.gcode_move = self.printer.load_object(config, 'gcode_move')
self.gcode = self.printer.lookup_object('gcode')
self.gcode.register_command("G2", self.cmd_G2)
- self.gcode.register_command("G3", self.cmd_G2)
+ self.gcode.register_command("G3", self.cmd_G3)
def cmd_G2(self, gcmd):
+ self._cmd_inner(gcmd, True)
+
+ def cmd_G3(self, gcmd):
+ self._cmd_inner(gcmd, False)
+
+ def _cmd_inner(self, gcmd, clockwise):
gcodestatus = self.gcode_move.get_status()
if not gcodestatus['absolute_coordinates']:
raise gcmd.error("G2/G3 does not support relative move mode")
@@ -40,7 +46,6 @@ class ArcSupport:
raise gcmd.error("G2/G3 neither I nor J given")
asE = gcmd.get_float("E", None)
asF = gcmd.get_float("F", None)
- clockwise = (gcmd.get_command() == 'G2')
# Build list of linear coordinates to move to
coords = self.planArc(currentPos, [asX, asY, asZ], [asI, asJ],