Group macros by topic, add Blobifier, fix first tool change

- Split the macro files into folders by topic (print, heating, afc,
  pressure_advance, spoolman, leds, sensors); klipper-macros.cfg is the
  one file printer.cfg includes. Macros moved unchanged; the effective
  config is identical apart from the paths of the PA shell scripts.
- Add the modified Blobifier (Turtleblobifier for AFC) and define
  [save_variables] once in save_variables.cfg instead of in both
  blobifier.cfg and the PA macros (same file, bd_pa_variables.cfg).
- PRINT_WARMUP: heat to the loaded lane's temperature before the first
  tool change. AFC skips heating when the loaded lane's tool number is
  not in the print file's temperature list, and the unload then failed
  below min_extrude_temp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-10 14:24:37 +02:00
1 parent 6dbb4ca3fb
commit eaf9c82617
27 files changed
+1366 -340

No files matched your search

+149
View File
@@ -0,0 +1,149 @@
# PAUSE, RESUME, CANCEL_PRINT, M600 (based on the KlipperScreen recommended macros)
# https://klipperscreen.readthedocs.io/en/latest/macros/#recommended
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
variable_saved_fan_speed: 0.0
gcode:
# SAVE_GCODE_STATE NAME=PAUSE_MACRO_state
# Save current fan speed
{% set current_fan = printer.fan.speed %}
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=saved_fan_speed VALUE={current_fan}
# Current position
{% set x = printer.toolhead.position.x|float %}
{% set y = printer.toolhead.position.y|float %}
# Determine target positions
{% set target_x = 340 if (x < 340 or x > 350) else x %}
{% set target_y = 340 if (y < 340 or y > 350) else y %}
# Only move if needed
{% if target_x != x or target_y != y %}
G90
G1 X{target_x} Y{target_y} F12000
{% endif %}
# Pause print
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
# Set fan to S28 (28/255 ≈ 0.1098)
M106 S28
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
variable_skip_restore: 0
gcode:
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
{% set skip = printer['gcode_macro RESUME'].skip_restore|int %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
#BLOBIFIER_CLEAN
#G1 Z10
# Restore saved fan speed
{% set old_fan = printer["gcode_macro PAUSE"].saved_fan_speed %}
{% if old_fan > 0 %}
{% set fan_pwm = (old_fan * 255) | int %}
{% if fan_pwm > 255 %}
{% set fan_pwm = 255 %}
{% endif %}
M106 S{fan_pwm}
{% else %}
M107
{% endif %}
{% if skip == 0 %}
# RESTORE_GCODE_STATE name=PAUSE_MACRO_state
RESUME_BASE {get_params}
{% else %}
RESPOND PREFIX="AFC" MSG="Skipping RESTORE_GCODE_STATE (drift resume)"
{% endif %}
_status_printing
CLEAR_PAUSE
RESET_FAILURE
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=skip_restore VALUE=0
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 2.0
gcode:
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
# {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set x_park = 20.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set z_park_delta = 2.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE_KLIPPERSCREEN
variable_park: True
gcode:
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
STOP_HEAT_SOAK
TURN_OFF_HEATERS
CANCEL_PRINT_BASE_KLIPPERSCREEN
[gcode_macro M600]
#
# M600
# https://github.com/simplisticton/common-macros/tree/main
#
# Mimic Marlin's Pause for filament change command
description: Pause for filament change
gcode:
PAUSE
M117 Paused
M118 Print paused for filament change... type "Resume" to continue