nfc2klipper/klipper-spoolman.cfg
2025-01-26 16:00:45 +01:00

51 lines
1.4 KiB
INI

# These are from Spoolman:
[gcode_macro SET_ACTIVE_SPOOL]
description: Set loaded spool's Spoolman ID in Moonraker
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]
description: Remove active spool ID in Moonraker
gcode:
{action_call_remote_method(
"spoolman_set_active_spool",
spool_id=None
)}
#####################################################################
# This is the configuration for filament handling:
#
# SPDX-FileCopyrightText: 2024 Sebastian Andersson <sebastian@bittr.nu>
# SPDX-License-Identifier: CC0-1.0
[gcode_macro SET_ACTIVE_FILAMENT]
description: Set loaded filament's Spoolman ID
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]
description: PAUSE print if wrong filament's Spoolman ID != ID
gcode:
{% if params.ID %}
{% set id = params.ID|int %}
{% set current_id = printer.save_variables.variables["active_filament"]|int %}
{% if id != current_id %}
M600
{% endif %}
{% else %}
{action_respond_info("Parameter 'ID' is required")}
{% endif %}