Commit Graph

27 Commits

Author SHA1 Message Date
Pedro Lamas 7ef7bf608a gcode_macro: Add "rawparams" pseudo-variable
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2021-11-19 11:22:36 -05:00
Eric Callahan 46381e03a4
gcode_macro: fix reference issues to the variables attribute (#4925)
Create a copy of the dictionary prior to updating the the variable field.
This fixes an issue where webhooks holds a reference to the variables
dict returned by get_status().

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2021-11-19 02:01:16 -05:00
Kevin O'Connor 6e0431907d gcode_macro: Remove support for deprecated features
Remove support for default_parameter_xxx config options.  Remove
support for direct access to command parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-11-02 12:45:11 -04:00
Kevin O'Connor 46167cae67 configfile: Add support for reporting deprecated options
Add a new printer.configfile.warnings with a list of config features
that are deprecated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-09-16 13:44:54 -04:00
Alex Zellner 341fc64a67
gcode_macro: add description property (#4317)
Signed-off-by: Alex Zellner <alexander.zellner@googlemail.com>
2021-05-26 14:21:21 -04:00
Florian Heilmann ba3bbca861
gcode_macro: Disallow whitespace in macro name (#4312)
Signed-off-by: Florian Heilmann <Florian.Heilmann@gmx.net>
2021-05-26 13:03:10 -04:00
Kevin O'Connor 023a985bfc gcode_macro: Use deepcopy() on get_status() results
If a get_status() method returns a mutable object (such as a list or
dict) then it would be possible for a gcode command template to
incorrectly alter the program's internal state.  Perform a deepcopy()
operation on all get_status() return results to avoid that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2021-01-20 16:25:25 -05:00
Arksine 8a5e7d8d28 gcode_macro: implement "action_call_remote_method" context action
Users may use this action to call methods registered by a webhooks client from a command template.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2020-11-04 18:32:30 -05:00
Kevin O'Connor b2c78d71b0 gcode: Remove "action_" commands from get_status() calls
Rename printer.gcode.action_emergency_stop() to
action_emergency_stop(), printer.gcode.action_respond_info() to
action_respond_info(), and printer.gcode.action_respond_error() to
action_raise_error() in command templates.

This simplifies the get_status() interface, as returning callable
functions from that interface was confusing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-08-20 21:03:22 -04:00
Kevin O'Connor 787ed452c2 klippy: Rename try_load_module() to load_object()
Rename try_load_module() so that it uses consistent naming for
"printer objects".  Change the function to raise an error by default
if the specified module does not exist.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-08 11:05:14 -04:00
Kevin O'Connor a13e681b2e gcode_macro: Use new GCodeCommand wrappers
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-05-05 11:08:11 -04:00
Kevin O'Connor ddb8311890 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>
2020-05-05 11:08:11 -04:00
Kevin O'Connor 9818055ac3 gcode_macro: Support overriding of builtin g-code commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2020-02-12 20:42:03 -05:00
Janar Sööt ec34d78d5e gcode_macro: add iterator to status wrapper
It really helps to see a snapshot of available printer variables when building menus and macros. The list of variables always depends on what printer config you have.

Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2019-07-01 10:59:13 -04:00
Kevin O'Connor 8b00580884 gcode_macro: Parse variable_X parameters using ast.literal_eval()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 19:33:31 -04:00
Kevin O'Connor 27ca159285 gcode_macro: Add a default parameter to load_template
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-07 10:51:57 -04:00
Kevin O'Connor d065787afc gcode_macro: Add support "x in printer" to templates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 12:41:28 -04:00
Kevin O'Connor a68f577adf gcode_macro: Add support for SET_GCODE_VARIABLE command
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -04:00
Kevin O'Connor ac8f6dfe20 gcode_macro: Rename "status" helper to "printer"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-06-04 09:50:30 -04:00
Kevin O'Connor 486c07c190 gcode_macro: Evaluate macros using Jinja2 template engine
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-04-04 18:35:23 -04:00
Kevin O'Connor b260eb9168 gcode: Raise a config error on invalid register_command()
Raise a printer.config_error() on an invalid register_command() call.
This error is easier to handle for the vast majority of callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-18 18:04:42 -05:00
Kevin O'Connor de7c1f76db gcode_macro: Provide more information on a formatting error
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-09-30 12:43:54 -04:00
Janar Sööt 68dc28580f gcode_macro: default parameter values
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-09-30 11:53:10 -04:00
Janar Sööt d22b30342a gcode_macro: 2 lines wrapped at 80 chars
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2018-09-26 08:03:39 -04:00
Janar Sööt 51d64ad7f8 gcode_macro: macro improvement with parameters
Signed-off-by: Janar Sööt <janar.soot@gmail.com>
2018-09-26 08:03:39 -04:00
Kevin O'Connor 4ad44e3e83 gcode: Rename run_script() to run_script_from_command()
Emphasize that the run_script() method is only valid when run from a
g-code command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-30 14:08:02 -04:00
Kevin O'Connor c38a63d4db gcode_macro: Add the ability to define custom g-code macros
Add the ability to add a custom g-code command that in turn executes
one or more configured g-code commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 12:40:06 -04:00