From a13e681b2e1373f3bac4c4f8a795eb1f9a02eaa6 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 24 Apr 2020 22:26:43 -0400 Subject: [PATCH] gcode_macro: Use new GCodeCommand wrappers Signed-off-by: Kevin O'Connor --- klippy/extras/gcode_macro.py | 12 +++++------- 1 file 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):