aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras')
-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):