-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move gcode macros to their own file, use save variable
- Loading branch information
Showing
2 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# These are from Spoolman: | ||
[gcode_macro SET_ACTIVE_SPOOL] | ||
gcode: | ||
{% if params.ID %} | ||
{% set id = params.ID|int %} | ||
{action_call_remote_method( | ||
"spoolman_set_active_spool", | ||
spool_id=id | ||
)} | ||
{% else %} | ||
{action_respond_info("Parameter 'ID' is required")} | ||
{% endif %} | ||
|
||
[gcode_macro CLEAR_ACTIVE_SPOOL] | ||
gcode: | ||
{action_call_remote_method( | ||
"spoolman_set_active_spool", | ||
spool_id=None | ||
)} | ||
|
||
|
||
# This is the extension for filament handling | ||
[gcode_macro SET_ACTIVE_FILAMENT] | ||
gcode: | ||
{% if params.ID %} | ||
{% set id = params.ID|int %} | ||
SAVE_VARIABLE VARIABLE=active_filament VALUE={id} | ||
{% else %} | ||
{action_respond_info("Parameter 'ID' is required")} | ||
{% endif %} | ||
|
||
[gcode_macro ASSERT_ACTIVE_FILAMENT] | ||
gcode: | ||
{% if params.ID %} | ||
{% set id = params.ID|int %} | ||
{% set current_id = printer.save_variables.variables["active_filament"]|int %} | ||
{% if id != current_id %} | ||
{action_raise_error("Wrong filament is loaded, should be " + id|string)} | ||
{% endif %} | ||
{% else %} | ||
{action_respond_info("Parameter 'ID' is required")} | ||
{% endif %} | ||
|