Chamber prints: unload a lane that is not the first tool before the soak

With the chamber heated, a filament left in the toolhead path softens in
the PTFE tube (PLA loaded, ASA print). After the first HOME, PRINT_WARMUP
unloads the loaded lane when it is not mapped to the print's first tool
(PRINT_START would swap it anyway). A failed unload stops the print
before the chamber heats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-17 19:56:30 +02:00
1 parent 6cc43f951d
commit 2100857846
1 file changed
+36
+36
View File
@@ -19,6 +19,7 @@ description: Print start before HEAT_SOAK: home while the bed heats, wait for th
gcode:
{% set target_bed = params.BED|int %}
{% set target_chamber = params.CHAMBER|default("0")|int %}
{% set initial_tool = params.TOOL|default("0")|int %}
RESET_FAILURE
CLEAR_PAUSE
@@ -48,6 +49,9 @@ gcode:
_NOZZLE_CONTACT_TEMP
RESPOND MSG="homing"
HOME
{% if target_chamber > 30 %}
_UNLOAD_FOR_CHAMBER TOOL={initial_tool}
{% endif %}
G1 X175 Y175 Z5 F1200
_STATUS STATE=heating_bed
@@ -67,6 +71,38 @@ gcode:
HEAT_SOAK HEATER='heater_bed' TARGET={target_bed} SOAKER='temperature_sensor bed_core' SOAK_TEMP={target_bed - 5} TIMEOUT=30 CANCEL='_NOTHING'
{% endif %}
# With the chamber heated, a filament that stays in the toolhead path softens
# in the PTFE tube (PLA loaded, ASA print). PRINT_START would swap a lane that
# is not the first tool's anyway, so unload it now, before the chamber heats.
# AFC moves the filament back into the Box Turtle, outside the chamber.
[gcode_macro _UNLOAD_FOR_CHAMBER]
description: Before a chamber soak: unload the toolhead when its lane is not mapped to TOOL (the print's first tool)
gcode:
{% set tool = 'T' ~ params.TOOL|default(0)|int %}
{% set cur = printer.AFC.current_load if 'AFC' in printer else none %}
{% if cur and ('AFC_stepper ' ~ cur) in printer %}
{% set lane = printer['AFC_stepper ' ~ cur] %}
{% if lane.map != tool %}
RESPOND MSG="Chamber heating: unloading {cur} ({lane.material}, {lane.map}), the print starts with {tool}"
_HEAT_FOR_LOADED_LANE TOOL={params.TOOL|default(0)|int}
TOOL_UNLOAD LANE={cur}
_UNLOAD_FOR_CHAMBER_VERIFY LANE={cur}
{% endif %}
{% endif %}
# Separate macro: rendered after TOOL_UNLOAD has run. A failed unload stops
# the print before the chamber heats.
[gcode_macro _UNLOAD_FOR_CHAMBER_VERIFY]
description: Helper for _UNLOAD_FOR_CHAMBER: stop the print when the lane is still loaded
gcode:
{% if printer.AFC.current_load %}
_ERROR MSG="Chamber heating: {params.LANE} could not be unloaded ({printer.AFC.current_load} still in the toolhead), print stopped before the chamber heats" DISPLAY="Unload failed, print stopped"
{% else %}
# The filament the retract was remembered for is gone
SAVE_VARIABLE VARIABLE=nozzle_retract VALUE=0
M104 S150
{% endif %}
# Beacon contact refuses a nozzle above contact_max_hotend_temperature (180C)
[gcode_macro _NOZZLE_CONTACT_TEMP]
description: Nozzle to 150C for Beacon contact; wait only while it is above MAXIMUM (default 170C), WAIT=1 also waits until it is at least 145C