aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/gcode_macro.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-04-24 22:26:43 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-05 11:08:11 -0400
commita13e681b2e1373f3bac4c4f8a795eb1f9a02eaa6 (patch)
tree377125f9e92ea593713c2aeabb27a8e09a2b295a /klippy/extras/gcode_macro.py
parentfb16e8810b3e2da76c16e05834dc6be5776e3172 (diff)
downloadkutter-a13e681b2e1373f3bac4c4f8a795eb1f9a02eaa6.tar.gz
kutter-a13e681b2e1373f3bac4c4f8a795eb1f9a02eaa6.tar.xz
kutter-a13e681b2e1373f3bac4c4f8a795eb1f9a02eaa6.zip
gcode_macro: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/gcode_macro.py')
-rw-r--r--klippy/extras/gcode_macro.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py
index b462e2cd..3f956487 100644
--- a/klippy/extras/gcode_macro.py
+++ b/klippy/extras/gcode_macro.py
@@ -138,20 +138,18 @@ class GCodeMacro:
def get_status(self, eventtime):
return dict(self.variables)
cmd_SET_GCODE_VARIABLE_help = "Set the value of a G-Code macro variable"
- def cmd_SET_GCODE_VARIABLE(self, params):
- variable = self.gcode.get_str('VARIABLE', params)
- value = self.gcode.get_str('VALUE', params)
+ def cmd_SET_GCODE_VARIABLE(self, gcmd):
+ variable = gcmd.get('VARIABLE')
+ value = gcmd.get('VALUE')
if variable not in self.variables:
if variable in self.kwparams:
self.kwparams[variable] = value
return
- raise self.gcode.error("Unknown gcode_macro variable '%s'" % (
- variable,))
+ raise gcmd.error("Unknown gcode_macro variable '%s'" % (variable,))
try:
literal = ast.literal_eval(value)
except ValueError as e:
- raise self.gcode.error("Unable to parse '%s' as a literal" % (
- value,))
+ raise gcmd.error("Unable to parse '%s' as a literal" % (value,))
self.variables[variable] = literal
cmd_desc = "G-Code macro"
def cmd(self, gcmd):