Fix pause/resume chain, shared print cleanup, add CLAUDE.md
- RESUME is defined only in print/pause_resume.cfg; heat_soak.cfg's duplicate replaced it (no unretract, no fan restore). It now runs HEAT_SOAK_RESUME -> _RESUME_PRINT -> RESUME_BASE. - PAUSE runs PAUSE_BASE first, then retracts and parks once (X20 Y345); a parked flag makes resume undo only what PAUSE did. - New _PRINT_CLEANUP shared by PRINT_END and CANCEL_PRINT: heaters incl. iHEATER_OFF, fan, M221 S100, bdwidth off, mesh and skew cleared. In PRINT_END it runs after RESTORE_GCODE_STATE so the flow reset sticks. - Add CLAUDE.md and tools/effective_config.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eaf9c82617
commit
9dc733b5bb
7 files changed
+245
-85
No files matched your search
@@ -118,7 +118,7 @@ gcode:
|
||||
description: Resume while heat soaking results in the soaking phase being skipped, any complete callback is run
|
||||
gcode:
|
||||
# {% set ON_RESUME = (params.ON_RESUME | default("_HEAT_SOAK__BASE_RESUME")) | string %}
|
||||
{% set ON_RESUME = (params.ON_RESUME | default("_HEAT_SOAK__BASE_RESUME")) | string %}
|
||||
{% set ON_RESUME = (params.ON_RESUME | default("RESUME_BASE")) | string %}
|
||||
{% set heat_soak = printer['gcode_macro HEAT_SOAK'] %}
|
||||
{% set stage = heat_soak.stage %}
|
||||
{% if stage == "heating" %}
|
||||
@@ -133,11 +133,8 @@ gcode:
|
||||
{ON_RESUME} {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro RESUME]
|
||||
description: Resume while heat soaking results in the soaking phase being skipped, any complete callback is run
|
||||
rename_existing: _HEAT_SOAK__BASE_RESUME
|
||||
gcode:
|
||||
HEAT_SOAK_RESUME ON_RESUME=_HEAT_SOAK__BASE_RESUME
|
||||
# RESUME is defined in print/pause_resume.cfg and calls HEAT_SOAK_RESUME
|
||||
# (a second [gcode_macro RESUME] here would replace that one completely).
|
||||
|
||||
[delayed_gcode _heat_soaker]
|
||||
# description: internal macro to handle heat soaking activity
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
#
|
||||
# [include klipper-macros/klipper-macros.cfg]
|
||||
#
|
||||
# Comment out what you do not use. Keep the order where noted: some
|
||||
# macros (PAUSE, RESUME, CANCEL_PRINT) are defined in more than one file
|
||||
# and the last definition wins.
|
||||
# Comment out what you do not use. Every macro is defined in exactly one
|
||||
# file: Klipper merges sections with the same name and the last one wins.
|
||||
#####################################################################
|
||||
|
||||
[include save_variables.cfg] # the one [save_variables] for all macros
|
||||
@@ -16,7 +15,7 @@
|
||||
[include blobifier/blobifier.cfg]
|
||||
|
||||
# Printing
|
||||
[include print/pause_resume.cfg] # before heating/heat_soak.cfg
|
||||
[include print/pause_resume.cfg]
|
||||
[include print/filament.cfg]
|
||||
[include print/homing.cfg]
|
||||
[include print/idle_timeout.cfg]
|
||||
@@ -25,7 +24,7 @@
|
||||
# Heating
|
||||
[include heating/bed_fans.cfg]
|
||||
[include heating/chamber_iheater.cfg]
|
||||
[include heating/heat_soak.cfg] # its RESUME wraps the one above
|
||||
[include heating/heat_soak.cfg]
|
||||
[include heating/soak_my_bed.cfg]
|
||||
[include heating/filament_drying.cfg]
|
||||
|
||||
|
||||
@@ -1,44 +1,42 @@
|
||||
# PAUSE, RESUME, CANCEL_PRINT, M600 (based on the KlipperScreen recommended macros)
|
||||
#
|
||||
# Chain on this printer (AFC renames PAUSE/RESUME at startup):
|
||||
# PAUSE -> AFC_PAUSE (saves position, z-hop) -> this PAUSE -> PAUSE_BASE
|
||||
# RESUME -> AFC_RESUME -> this RESUME -> HEAT_SOAK_RESUME -> _RESUME_PRINT
|
||||
# -> RESUME_BASE, then AFC restores the saved position
|
||||
# RESUME is defined only here: heating/heat_soak.cfg used to define its own,
|
||||
# which replaced this one completely (no unretract, no fan restore).
|
||||
|
||||
# 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
|
||||
variable_parked: False # set by PAUSE, used by _RESUME_PRINT
|
||||
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
|
||||
{% if not printer.pause_resume.is_paused %}
|
||||
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=saved_fan_speed VALUE={printer.fan.speed}
|
||||
# Pause first, so the saved state is the print position, then retract and park
|
||||
PAUSE_BASE
|
||||
_TOOLHEAD_PARK_PAUSE_CANCEL
|
||||
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=True
|
||||
# Set fan to S28 (28/255 ≈ 0.1098)
|
||||
M106 S28
|
||||
{% else %}
|
||||
PAUSE_BASE
|
||||
{% 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
|
||||
description: Resume the print (while HEAT_SOAK runs: skip the soak phase)
|
||||
rename_existing: RESUME_BASE
|
||||
variable_skip_restore: 0
|
||||
gcode:
|
||||
HEAT_SOAK_RESUME ON_RESUME=_RESUME_PRINT {rawparams}
|
||||
|
||||
[gcode_macro _RESUME_PRINT]
|
||||
description: Resume after PAUSE: unretract, restore the part fan, continue the print
|
||||
gcode:
|
||||
{% set pause = printer["gcode_macro PAUSE"] %}
|
||||
{% 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) %}
|
||||
@@ -46,40 +44,28 @@ gcode:
|
||||
{% 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
|
||||
# Only undo what PAUSE did; HEAT_SOAK pauses with PAUSE_BASE (no retract, no park)
|
||||
{% if pause.parked %}
|
||||
{% 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 %}
|
||||
|
||||
# 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 %}
|
||||
# Restore saved fan speed
|
||||
{% set old_fan = pause.saved_fan_speed %}
|
||||
{% if old_fan > 0 %}
|
||||
M106 S{[(old_fan * 255)|int, 255]|min}
|
||||
{% else %}
|
||||
M107
|
||||
{% endif %}
|
||||
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=False
|
||||
{% 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 %}
|
||||
|
||||
|
||||
RESUME_BASE {get_params}
|
||||
_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
|
||||
@@ -129,12 +115,12 @@ gcode:
|
||||
_TOOLHEAD_PARK_PAUSE_CANCEL
|
||||
{% endif %}
|
||||
|
||||
STOP_HEAT_SOAK
|
||||
|
||||
TURN_OFF_HEATERS
|
||||
STOP_HEAT_SOAK
|
||||
CANCEL_PRINT_BASE_KLIPPERSCREEN
|
||||
|
||||
|
||||
# Same cleanup as PRINT_END: heaters incl. chamber heater, fan, flow, bdwidth
|
||||
_PRINT_CLEANUP
|
||||
SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=parked VALUE=False
|
||||
_status_ready
|
||||
|
||||
[gcode_macro M600]
|
||||
#
|
||||
|
||||
@@ -125,7 +125,7 @@ gcode:
|
||||
|
||||
[gcode_macro _NOTHING]
|
||||
gcode:
|
||||
_HEAT_SOAK__BASE_RESUME
|
||||
RESUME_BASE
|
||||
|
||||
[gcode_macro PRINT_START]
|
||||
gcode:
|
||||
@@ -220,8 +220,6 @@ gcode:
|
||||
|
||||
_motion_detected
|
||||
|
||||
M221 S100
|
||||
|
||||
M400 ; wait for buffer to clear
|
||||
G92 E0 ; zero the extruder
|
||||
# G1 E-0.5 F1800 ; retract filament
|
||||
@@ -234,21 +232,27 @@ gcode:
|
||||
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
|
||||
|
||||
|
||||
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
|
||||
# After the restore: RESTORE_GCODE_STATE also restores the flow (M221)
|
||||
_PRINT_CLEANUP
|
||||
|
||||
# End-of-print cleanup shared by PRINT_END and CANCEL_PRINT
|
||||
[gcode_macro _PRINT_CLEANUP]
|
||||
description: Heaters (incl. chamber heater) and part fan off, flow back to 100%, bdwidth off, mesh and skew cleared
|
||||
gcode:
|
||||
TURN_OFF_HEATERS
|
||||
iHEATER_OFF ; stops the chamber heater control loop too
|
||||
M107
|
||||
SET_BDWIDTH NAME=fila_width_0 COMMAND=DISABLE ; also sets M221 S100
|
||||
M221 S100
|
||||
BED_MESH_CLEAR
|
||||
SET_SKEW CLEAR=1
|
||||
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
|
||||
|
||||
[delayed_gcode _delayed_motors_off]
|
||||
gcode:
|
||||
|
||||
Reference in new issue
Block a user