From ddb8311890a130e3735d77fbb7fb24900a5152b2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 22 Apr 2020 12:40:32 -0400 Subject: gcode: Create new wrapper class for gcode command parameters Instead of passing a dictionary to the command handlers, create a wrapper class and pass that class to the command handlers. This can simplify the command handler code. Signed-off-by: Kevin O'Connor --- klippy/extras/gcode_macro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'klippy/extras/gcode_macro.py') diff --git a/klippy/extras/gcode_macro.py b/klippy/extras/gcode_macro.py index 2d4ebc75..b462e2cd 100644 --- a/klippy/extras/gcode_macro.py +++ b/klippy/extras/gcode_macro.py @@ -154,10 +154,10 @@ class GCodeMacro: value,)) self.variables[variable] = literal cmd_desc = "G-Code macro" - def cmd(self, params): + def cmd(self, gcmd): if self.in_script: - raise self.gcode.error( - "Macro %s called recursively" % (self.alias,)) + raise gcmd.error("Macro %s called recursively" % (self.alias,)) + params = gcmd.get_command_parameters() kwparams = dict(self.kwparams) kwparams.update(params) kwparams.update(self.variables) -- cgit v1.2.3-70-g09d2