variable_threshold: 50 # If bed temp target is above this threshold, fans will be enabled. If temp is set to below this threshold, fans will be disabled.
variable_fast: 1.0 # Fan speed once bed temp is reached
variable_slow: 0.5 # Fan speed while bed is heating
variable_cooldown_temp: 40 # NEW: fans stop below this temp
gcode:
########## Aliases #########
[gcode_macro BEDFANSSLOW]
gcode:
# Vars
{% set SLOW=printer["gcode_macro _BEDFANVARS"].slow|float %}
SET_FAN_SPEED FAN=BedFans SPEED={SLOW}
[gcode_macro BEDFANSFAST]
gcode:
# Vars
{% set FAST=printer["gcode_macro _BEDFANVARS"].fast|float %}
SET_FAN_SPEED FAN=BedFans SPEED={FAST}
[gcode_macro BEDFANSOFF]
gcode:
SET_FAN_SPEED FAN=BedFans SPEED=0
############ Command overrides ############
# Override, set fan speeds to low and start monitoring loop.
[gcode_macro SET_HEATER_TEMPERATURE]
rename_existing: _SET_HEATER_TEMPERATURE
gcode:
# Parameters
{% set HEATER=params.HEATER|default("None") %}
{% set TARGET = params.TARGET|default(0)|int %}
# Vars
{% set THRESHOLD = printer["gcode_macro _BEDFANVARS"].threshold|int %}
{% set COOLDOWN = printer["gcode_macro _BEDFANVARS"].cooldown_temp|int %}
{% if HEATER|lower== "extruder" %}
M104 S{TARGET}
# {% elif HEATER|lower == "iHeater_H" %}
# _SET_HEATER_TEMPERATURE {rawparams}
{% elif HEATER|lower== "heater_bed" %}
M99140 S{TARGET}
# Always cancel cooldown loop first (prevents overlap)
UPDATE_DELAYED_GCODE ID=bedfancooldown DURATION=0
# --- NEW LOGIC BLOCK ---
{% if TARGET== 0 %}
# Bed turning off → start cooldown behavior
{% if printer.heater_bed.temperature|int > COOLDOWN %}