mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-08 07:27:43 -06:00
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>
This commit is contained in:
parent
1eb2d4da90
commit
ddb8311890
7 changed files with 103 additions and 60 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue