aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/gcode_macro.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-04-22 12:40:32 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-05 11:08:11 -0400
commitddb8311890a130e3735d77fbb7fb24900a5152b2 (patch)
tree8b80d4f7f298fb0b536c6fb4dc5156e245c0cc25 /klippy/extras/gcode_macro.py
parent1eb2d4da902867b3bf4fdee1b2d272c170f93468 (diff)
downloadkutter-ddb8311890a130e3735d77fbb7fb24900a5152b2.tar.gz
kutter-ddb8311890a130e3735d77fbb7fb24900a5152b2.tar.xz
kutter-ddb8311890a130e3735d77fbb7fb24900a5152b2.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/gcode_macro.py')
-rw-r--r--klippy/extras/gcode_macro.py6
1 files changed, 3 insertions, 3 deletions
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)