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:
1 parent
6dbb4ca3fb
commit
eaf9c82617
27 files changed
+1366
-340
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# LOAD_FILAMENT, UNLOAD_FILAMENT (based on the KlipperScreen recommended macros)
|
||||
|
||||
[gcode_macro LOAD_FILAMENT]
|
||||
variable_load_distance: 60
|
||||
variable_purge_distance: 20
|
||||
gcode:
|
||||
{% set speed = params.SPEED|default(15) %}
|
||||
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 15 %}
|
||||
SAVE_GCODE_STATE NAME=load_state
|
||||
G91
|
||||
G92 E0
|
||||
G1 E{load_distance} F{max_velocity} # fast-load
|
||||
G1 E{purge_distance} F{speed} # purge
|
||||
RESTORE_GCODE_STATE NAME=load_state
|
||||
|
||||
[gcode_macro UNLOAD_FILAMENT]
|
||||
variable_unload_distance: 100
|
||||
variable_purge_distance: 0
|
||||
gcode:
|
||||
{% set speed = params.SPEED|default(15) %}
|
||||
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 30 %}
|
||||
SAVE_GCODE_STATE NAME=unload_state
|
||||
G91
|
||||
G92 E0
|
||||
G1 E{purge_distance} F{speed} # purge
|
||||
G1 E-20 F100# unload
|
||||
G1 E-{unload_distance} F{max_velocity} # fast-unload
|
||||
RESTORE_GCODE_STATE NAME=unload_state
|
||||
@@ -0,0 +1,8 @@
|
||||
# HOME: home all axes and move to the bed centre
|
||||
|
||||
[gcode_macro HOME]
|
||||
gcode:
|
||||
G90
|
||||
G4 P2000
|
||||
G28 X0 Y0 Z0
|
||||
G1 X175 Y175 Z10 F1200
|
||||
@@ -0,0 +1,23 @@
|
||||
# Idle timeout: heaters and motors off when the printer is idle
|
||||
|
||||
# [dynamicmacros]
|
||||
# configs: Macros/dynamicmacros.cfg
|
||||
|
||||
# [gcode_button kill_switch]
|
||||
# pin: gpio7
|
||||
# press_gcode: M112
|
||||
|
||||
[idle_timeout]
|
||||
gcode:
|
||||
TURN_OFF_HEATERS
|
||||
iHEATER_OFF ; Turns off the chamber heater
|
||||
M84
|
||||
# reset paused flag
|
||||
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
|
||||
_TOOLHEAD_PARK_PAUSE_CANCEL
|
||||
{% endif %}
|
||||
_status_ready
|
||||
# A list of G-Code commands to execute on an idle timeout. See
|
||||
# docs/Command_Templates.md for G-Code format. The default is to run
|
||||
# "TURN_OFF_HEATERS" and "M84".
|
||||
timeout: 85400 # 24 hours
|
||||
@@ -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
|
||||
@@ -0,0 +1,255 @@
|
||||
# Print start and end: PRINT_WARMUP, PRINT_START, PRINT_END
|
||||
|
||||
# Idle time (in seconds) to wait before running the above G-Code
|
||||
# commands. The default is 600 seconds.
|
||||
|
||||
#####################################################################
|
||||
# Macros
|
||||
#####################################################################
|
||||
|
||||
# [gcode_macro PRINT_START]
|
||||
# gcode:
|
||||
# PRINT_WARMUP BED={params.BED} EXTRUDER={params.EXTRUDER} CHAMBER={params.CHAMBER|default("0")} TOOL={params.TOOL|default("0")}
|
||||
# PRINT_START_2 EXTRUDER={params.EXTRUDER}
|
||||
|
||||
[gcode_macro PRINT_WARMUP]
|
||||
description: Perform initial homing and heating tasks
|
||||
gcode:
|
||||
{% set target_bed = params.BED|int %}
|
||||
{% set target_extruder = params.EXTRUDER|int %}
|
||||
{% set target_chamber = params.CHAMBER|default("0")|int %}
|
||||
# {% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %}
|
||||
# {% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %}
|
||||
{% set initial_tool = params.TOOL|default("0")|int %}
|
||||
|
||||
{% set chamber_temp = printer["temperature_sensor chamber"].temperature|float %}
|
||||
|
||||
RESET_FAILURE
|
||||
CLEAR_PAUSE
|
||||
|
||||
_motion_detected
|
||||
|
||||
#SET_PIN PIN=caselight VALUE=1.00
|
||||
UPDATE_DELAYED_GCODE ID=_delayed_motors_off DURATION=0
|
||||
|
||||
BED_MESH_CLEAR
|
||||
SET_GCODE_OFFSET Z=0
|
||||
|
||||
CLEAR_PAUSE
|
||||
|
||||
SKEW_PROFILE LOAD=Califlower
|
||||
|
||||
{% set current_temp = printer.extruder.temperature %}
|
||||
{% if current_temp > 150 %}
|
||||
RESPOND MSG="nozzle to hot, lowering to 150"
|
||||
M104 S150 ; set nozzle temp to 150
|
||||
M109 S150 ; wait until nozzle reaches 150 ; wait until nozzle reaches 0
|
||||
{% endif %}
|
||||
|
||||
_status_homing
|
||||
RESPOND MSG="homing"
|
||||
HOME
|
||||
RESPOND MSG="homing finished"
|
||||
# G0 Z2 ; position beacon at 2mm for heat soak
|
||||
|
||||
{% if target_bed < 60 %}
|
||||
RESPOND MSG="Using PID for <60°C bed"
|
||||
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={target_bed} PID_KP=33.606 PID_KI=0.694 PID_KD=407.058
|
||||
{% else %}
|
||||
RESPOND MSG="Using PID for ≥60°C bed"
|
||||
SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={target_bed} pid_Kp=46.843 pid_Ki=2.002 pid_Kd=274.034
|
||||
{% endif %}
|
||||
|
||||
G1 X175 Y175 Z2 F1200
|
||||
_status_heating
|
||||
RESPOND MSG="heating"
|
||||
{% if target_bed > 0 %}
|
||||
M140 S{target_bed} ; start bed heater
|
||||
M104 S150 ; set nozzle temp to 150
|
||||
M109 S150 ; wait until nozzle reaches 150 ; wait until nozzle reaches 0
|
||||
M190 S{target_bed} ; wait on bed temperature
|
||||
{% endif %}
|
||||
|
||||
HOME
|
||||
QUAD_GANTRY_LEVEL
|
||||
BLOBIFIER_CLEAN ; call another macro to wipe nozzle if available
|
||||
G1 X175 Y175 Z5 F1200
|
||||
|
||||
_HEAT_FOR_LOADED_LANE TOOL={initial_tool} ; unload needs the loaded filament's temperature
|
||||
T{initial_tool} #PURGE_LENGTH=100 #Load Initial Tool
|
||||
M104 S{target_extruder} ; set extruder to print temp
|
||||
M109 S{target_extruder} ; wait for extruder temp
|
||||
G10 ; retract
|
||||
|
||||
M104 S150 ; set nozzle temp to 150
|
||||
M109 S150 ; wait until nozzle reaches 150 ; wait until nozzle reaches 0
|
||||
|
||||
BLOBIFIER_CLEAN ; call another macro to wipe nozzle if available
|
||||
|
||||
G1 X175 Y175 Z5 F1200
|
||||
{% if target_chamber > 30 %}
|
||||
RESPOND MSG="waiting for chamber temperature"
|
||||
M141 S{target_chamber}
|
||||
# M191 S{target_chamber} ; Waits until the chamber temperature reaches 60°C
|
||||
# TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_chamber}
|
||||
|
||||
M106 S255
|
||||
# HEAT_SOAK HEATER='heater_bed' TARGET={BED_TEMP} SOAKER='temperature_sensor iHeater_S' SOAK_TEMP={target_chamber} TIMEOUT=60 CANCEL='_NOTHING'
|
||||
HEAT_SOAK HEATER='heater_bed' TARGET={target_bed} SOAKER='temperature_sensor chamber' SOAK_TEMP={target_chamber} TIMEOUT=60 CANCEL='_NOTHING'
|
||||
# (CANCEL='_NOTHING') and having unreachable SOAK_TEMP makes it run till the TIMEOUT and continue without canceling the print.
|
||||
{% else %}
|
||||
RESPOND MSG="waiting for bed core temperature"
|
||||
|
||||
HEAT_SOAK HEATER='heater_bed' TARGET={target_bed} SOAKER='temperature_sensor bed_core' SOAK_TEMP={target_bed - 5} TIMEOUT=30 CANCEL='_NOTHING'
|
||||
# (CANCEL='_NOTHING') and having unreachable SOAK_TEMP makes it run till the TIMEOUT and continue without canceling the print.
|
||||
{% endif %}
|
||||
|
||||
# AFC heats for a tool change from the print file's per-tool temperatures.
|
||||
# When the loaded lane's tool number is not in that list (for example lane5 =
|
||||
# T4 loaded, single-colour print with only T0), AFC does not heat at all and
|
||||
# the unload fails below min_extrude_temp. Heat for the loaded filament first.
|
||||
[gcode_macro _HEAT_FOR_LOADED_LANE]
|
||||
description: Heat to the loaded lane's filament temperature before changing to another tool
|
||||
gcode:
|
||||
{% set tool = 'T' ~ params.TOOL|default(0)|int %}
|
||||
{% set cur = printer.AFC.current_load %}
|
||||
{% if cur and ('AFC_stepper ' ~ cur) in printer %}
|
||||
{% set lane = printer['AFC_stepper ' ~ cur] %}
|
||||
{% if lane.map != tool %}
|
||||
{% set min_temp = printer.configfile.settings.extruder.min_extrude_temp|int + 20 %}
|
||||
{% set temp = [lane.extruder_temp|default(0, true)|int, min_temp]|max %}
|
||||
RESPOND MSG="Heating to {temp}C to unload {cur} ({lane.material}) before {tool}"
|
||||
M109 S{temp}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro _NOTHING]
|
||||
gcode:
|
||||
_HEAT_SOAK__BASE_RESUME
|
||||
|
||||
[gcode_macro PRINT_START]
|
||||
gcode:
|
||||
RESPOND MSG="print start macro continued"
|
||||
|
||||
_motion_detected
|
||||
|
||||
{% set target_extruder = params.EXTRUDER|int %}
|
||||
|
||||
M106 S0
|
||||
|
||||
M104 S150 ; set nozzle temp to 150
|
||||
M109 S150 ; wait until nozzle reaches 150 ; wait until nozzle reaches 0
|
||||
|
||||
HOME
|
||||
BLOBIFIER_CLEAN ; call another macro to wipe nozzle if available
|
||||
|
||||
_status_calibrating_z
|
||||
G28 Z METHOD=CONTACT CALIBRATE=1 ; calibrate z offset and beacon model hot
|
||||
|
||||
_status_leveling
|
||||
RESPOND MSG="quad ganrty level"
|
||||
QUAD_GANTRY_LEVEL
|
||||
|
||||
_status_meshing
|
||||
RESPOND MSG="meshing"
|
||||
BED_MESH_CALIBRATE RUNS=2 ; bed mesh in scan mode
|
||||
|
||||
BLOBIFIER_CLEAN ; call another macro to wipe nozzle if available
|
||||
|
||||
M104 S150 ; set nozzle temp to 150
|
||||
M109 S150 ; wait until nozzle reaches 150 ; wait until nozzle reaches 0
|
||||
|
||||
_status_calibrating_z
|
||||
G28 Z METHOD=CONTACT CALIBRATE=1 ; calibrate z offset and beacon model hot
|
||||
|
||||
_status_heating
|
||||
M104 S{target_extruder} ; set extruder to print temp
|
||||
M109 S{target_extruder} ; wait for extruder temp
|
||||
|
||||
# ; needs fine tuning, long meltzones require more
|
||||
# SET_GCODE_OFFSET Z_ADJUST={OFFSET} ; apply optional material squish via slicer
|
||||
#SET_GCODE_OFFSET Z=-0.06 ; squish
|
||||
# SET_GCODE_OFFSET Z=0.02 ; squish # worked before but a bit to high now
|
||||
# SET_GCODE_OFFSET Z=-0.05 ; squish
|
||||
SET_GCODE_OFFSET Z=-0.00 ; squish
|
||||
|
||||
RESPOND MSG="starting"
|
||||
;PRIME_NOZZLE ; call another macro to purge or prime nozzle
|
||||
# WIPE_NOZZLE ; call another macro to wipe nozzle if available
|
||||
# Line_Purge
|
||||
# AFC_POOP PURGE_LENGTH=100
|
||||
# AFC_KICK
|
||||
|
||||
BLOBIFIER_CLEAN
|
||||
|
||||
PA_CALIBRATE_ALL_LANES LANES="lane1,lane2,lane3,lane4,lane5"
|
||||
|
||||
M104 S{target_extruder} ; set extruder to print temp
|
||||
M109 S{target_extruder} ; wait for extruder temp
|
||||
|
||||
BLOBIFIER_CLEAN
|
||||
|
||||
; start printing
|
||||
|
||||
G90 ; absolute positioning
|
||||
G1 Z20 F30000 ; move nozzle away from bed
|
||||
G1 X175 Y175 F30000 ; move nozzle away from bed
|
||||
|
||||
G28 XYZ
|
||||
|
||||
#G11 ; unretract
|
||||
|
||||
_AFC_STORE_HOME_REFERENCE
|
||||
|
||||
SET_BDWIDTH NAME=fila_width_0 COMMAND=ENABLE_ALL
|
||||
# SET_BDWIDTH NAME=fila_width_0 COMMAND=ENABLE_MOTION
|
||||
|
||||
_status_printing
|
||||
|
||||
|
||||
[gcode_macro PRINT_END]
|
||||
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
|
||||
gcode:
|
||||
# safe anti-stringing move coords
|
||||
{% set th = printer.toolhead %}
|
||||
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
|
||||
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
|
||||
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
|
||||
|
||||
SAVE_GCODE_STATE NAME=STATE_PRINT_END
|
||||
|
||||
_motion_detected
|
||||
|
||||
M221 S100
|
||||
|
||||
M400 ; wait for buffer to clear
|
||||
G92 E0 ; zero the extruder
|
||||
# G1 E-0.5 F1800 ; retract filament
|
||||
G10 ; retract
|
||||
|
||||
TURN_OFF_HEATERS
|
||||
iHEATER_OFF ; Turns off the chamber heater
|
||||
|
||||
G90 ; absolute positioning
|
||||
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
|
||||
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 5} F3600 ; park nozzle at rear
|
||||
M107 ; turn off fan
|
||||
|
||||
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
|
||||
_TOOLHEAD_PARK_PAUSE_CANCEL
|
||||
{% endif %}
|
||||
|
||||
SET_BDWIDTH NAME=fila_width_0 COMMAND=DISABLE ;disable the bdwidth
|
||||
|
||||
#SET_PIN PIN=caselight VALUE=0.03
|
||||
_status_part_ready
|
||||
|
||||
UPDATE_DELAYED_GCODE ID=_delayed_motors_off DURATION=3600
|
||||
|
||||
BED_MESH_CLEAR
|
||||
SET_SKEW CLEAR=1
|
||||
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
|
||||
|
||||
[delayed_gcode _delayed_motors_off]
|
||||
gcode:
|
||||
M84
|
||||
Reference in new issue
Block a user