Skip to content

Commit

Permalink
gcode_macro: Remove support for deprecated features
Browse files Browse the repository at this point in the history
Remove support for default_parameter_xxx config options.  Remove
support for direct access to command parameters.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Nov 2, 2021
1 parent 0382ffb commit 6e04319
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions klippy/extras/gcode_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ def __init__(self, config):
name, self.cmd_SET_GCODE_VARIABLE,
desc=self.cmd_SET_GCODE_VARIABLE_help)
self.in_script = False
prefix = 'default_parameter_'
self.kwparams = {}
for option in config.get_prefix_options(prefix):
config.deprecate(option)
self.kwparams[option[len(prefix):].upper()] = config.get(option)
self.variables = {}
prefix = 'variable_'
for option in config.get_prefix_options(prefix):
Expand All @@ -171,9 +166,6 @@ 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 gcmd.error("Unknown gcode_macro variable '%s'" % (variable,))
try:
literal = ast.literal_eval(value)
Expand All @@ -183,12 +175,9 @@ def cmd_SET_GCODE_VARIABLE(self, gcmd):
def cmd(self, gcmd):
if self.in_script:
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)
kwparams = dict(self.variables)
kwparams.update(self.template.create_template_context())
kwparams['params'] = params
kwparams['params'] = gcmd.get_command_parameters()
self.in_script = True
try:
self.template.run_gcode_from_command(kwparams)
Expand Down

0 comments on commit 6e04319

Please sign in to comment.