Bed fans off during prints without a heated chamber, remove unused bed PID

With the chamber open the bed fans only blow room air past the bed. PRINT_WARMUP
sets print_fans_off for CHAMBER 30 or less, _PRINT_CLEANUP clears it. Chamber
prints, the cooldown and heating the bed outside a print are unchanged.

The PID values in PRINT_WARMUP never took effect: the SET_HEATER_TEMPERATURE
override in bed_fans.cfg only passes on the target. The bed keeps its config
values; the misleading console messages are gone.

Tested with rendered macros only, not yet on the printer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-06 16:18:38 +01:00
1 parent 99b7109b5b
commit 1dcbc50bf6
3 files changed
+21 -14

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ everything below, grouped by topic. Comment out what you do not use there.
| **heating/** | | | | **heating/** | | |
| `heat_soak.cfg` | `HEAT_SOAK`, `STOP_HEAT_SOAK`, `CANCEL_HEAT_SOAK`, `HEAT_SOAK_RESUME`, `RESUME` | — | | `heat_soak.cfg` | `HEAT_SOAK`, `STOP_HEAT_SOAK`, `CANCEL_HEAT_SOAK`, `HEAT_SOAK_RESUME`, `RESUME` | — |
| `soak_my_bed.cfg` | `SOAK_MY_BED` (homes and levels first) | soak-my-bed | | `soak_my_bed.cfg` | `SOAK_MY_BED` (homes and levels first) | soak-my-bed |
| `bed_fans.cfg` | Bed fans through `SET_HEATER_TEMPERATURE`/`M190`/`M140`/`TURN_OFF_HEATERS` overrides | `[fan_generic BedFans]` | | `bed_fans.cfg` | Bed fans through `SET_HEATER_TEMPERATURE`/`M190`/`M140`/`TURN_OFF_HEATERS` overrides; off during a print without a heated chamber (`PRINT_WARMUP CHAMBER=` 30 or less), on during the cooldown after any print | `[fan_generic BedFans]` |
| `chamber_iheater.cfg` | iHeater MCU, heater and sensors, `M141`, `M191`, `iHEATER_ON`, `iHEATER_OFF` | iHeater chamber heater | | `chamber_iheater.cfg` | iHeater MCU, heater and sensors, `M141`, `M191`, `iHEATER_ON`, `iHEATER_OFF` | iHeater chamber heater |
| `filament_drying.cfg` | `START_DRYING`, `STOP_DRYING`, `STATUS_DRYING` | bed fans, chamber heater (optional) | | `filament_drying.cfg` | `START_DRYING`, `STOP_DRYING`, `STATUS_DRYING` | bed fans, chamber heater (optional) |
| **afc/** | | | | **afc/** | | |
+14 -6
View File
@@ -1,4 +1,9 @@
# Bed fans driven by the bed heater (based on Ellis' bed fan macros) # Bed fans driven by the bed heater (based on Ellis' bed fan macros)
#
# During a print without a heated chamber the fans stay off while the bed heats,
# soaks and prints: with the chamber open they only blow room air past the bed.
# PRINT_WARMUP sets print_fans_off, _PRINT_CLEANUP clears it. The cooldown after
# the print and heating the bed outside a print are not affected.
############### Config options ################## ############### Config options ##################
@@ -7,6 +12,7 @@ variable_threshold: 50 # If bed temp target is above this threshold, fans will
variable_fast: 1.0 # Fan speed once bed temp is reached variable_fast: 1.0 # Fan speed once bed temp is reached
variable_slow: 0.5 # Fan speed while bed is heating variable_slow: 0.5 # Fan speed while bed is heating
variable_cooldown_temp: 40 # NEW: fans stop below this temp variable_cooldown_temp: 40 # NEW: fans stop below this temp
variable_print_fans_off: False # set by PRINT_WARMUP for a print without a heated chamber
gcode: gcode:
########## Aliases ######### ########## Aliases #########
@@ -41,6 +47,7 @@ gcode:
# Vars # Vars
{% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %} {% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %}
{% set COOLDOWN = printer["gcode_macro _BEDFANVARS"].cooldown_temp|int %} {% set COOLDOWN = printer["gcode_macro _BEDFANVARS"].cooldown_temp|int %}
{% set FANS_OFF = printer["gcode_macro _BEDFANVARS"].print_fans_off %}
{% if HEATER|lower == "extruder" %} {% if HEATER|lower == "extruder" %}
M104 S{TARGET} M104 S{TARGET}
@@ -67,13 +74,13 @@ gcode:
# Stop normal heating loop if running # Stop normal heating loop if running
UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=0 UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=0
{% elif TARGET >= THRESHOLD %} {% elif TARGET >= THRESHOLD and not FANS_OFF %}
# Heating above threshold # Heating above threshold
BEDFANSSLOW BEDFANSSLOW
UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=1 UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=1
{% else %} {% else %}
# Low temp request # Low temp request, or a print without a heated chamber
BEDFANSOFF BEDFANSOFF
UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=0 UPDATE_DELAYED_GCODE ID=bedfanloop DURATION=0
{% endif %} {% endif %}
@@ -93,8 +100,9 @@ gcode:
{% set S = params.S|int %} {% set S = params.S|int %}
# Vars # Vars
{% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %} {% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %}
{% set FANS_ON = S >= THRESHOLD and not printer["gcode_macro _BEDFANVARS"].print_fans_off %}
{% if S >= THRESHOLD %} {% if FANS_ON %}
BEDFANSSLOW # >= Threshold temp: Low speed fans while heating BEDFANSSLOW # >= Threshold temp: Low speed fans while heating
{% else %} {% else %}
BEDFANSOFF # < Threshold temp: Turn bed fans off BEDFANSOFF # < Threshold temp: Turn bed fans off
@@ -109,8 +117,8 @@ gcode:
{% endif %} {% endif %}
# Post-heating fan speeds # Post-heating fan speeds
{% if S >= THRESHOLD %} {% if FANS_ON %}
BEDFANSFAST # >= Threshold temp: Higher speed fans after heating finished BEDFANSFAST # >= Threshold temp: Higher speed fans after heating finished
{% endif %} {% endif %}
# Replace M140 (Set Bed Temperature) to just be an alias of SET_HEATER_TEMPERATURE (which has associated bed fan logic if enabled) # Replace M140 (Set Bed Temperature) to just be an alias of SET_HEATER_TEMPERATURE (which has associated bed fan logic if enabled)
@@ -152,7 +160,7 @@ gcode:
# Vars # Vars
{% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %} {% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %}
{% if printer.heater_bed.target >= THRESHOLD %} # Continue only if target temp greater than threshold. {% if printer.heater_bed.target >= THRESHOLD and not printer["gcode_macro _BEDFANVARS"].print_fans_off %} # Continue only if target temp greater than threshold.
{% if printer.heater_bed.temperature|int >= (printer.heater_bed.target|int - 1) %} {% if printer.heater_bed.temperature|int >= (printer.heater_bed.target|int - 1) %}
BEDFANSFAST # If within 1 degree of target temp: Higher speed fans BEDFANSFAST # If within 1 degree of target temp: Higher speed fans
{% else %} {% else %}
+6 -7
View File
@@ -40,14 +40,12 @@ gcode:
SKEW_PROFILE LOAD=Califlower SKEW_PROFILE LOAD=Califlower
M106 S0 M106 S0
# Bed fans only help to heat a closed chamber: off for this print without
# one (heating/bed_fans.cfg). Set before the bed target, which reads it.
SET_GCODE_VARIABLE MACRO=_BEDFANVARS VARIABLE=print_fans_off VALUE={target_chamber <= 30}
# Bed first, so it heats during the rest of the warmup # Bed first, so it heats during the rest of the warmup
{% if target_bed < 60 %} SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={target_bed}
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 %}
# Only to get the toolhead over the bed for the soak; the Z that counts # Only to get the toolhead over the bed for the soak; the Z that counts
# is the contact calibration in PRINT_START on the soaked bed # is the contact calibration in PRINT_START on the soaked bed
@@ -347,6 +345,7 @@ description: Heaters (incl. chamber heater) and part fan off, flow back to 100%,
gcode: gcode:
_GUARD_OFF ; a print start that failed while it was armed _GUARD_OFF ; a print start that failed while it was armed
_BED_CHECK_RESET ; cancelled while the bed check had it paused _BED_CHECK_RESET ; cancelled while the bed check had it paused
SET_GCODE_VARIABLE MACRO=_BEDFANVARS VARIABLE=print_fans_off VALUE=False
TURN_OFF_HEATERS TURN_OFF_HEATERS
iHEATER_OFF ; stops the chamber heater control loop too iHEATER_OFF ; stops the chamber heater control loop too
M107 M107