diff --git a/printer_data/config/CUSTOM/chamber_heat.cfg b/printer_data/config/CUSTOM/chamber_heat.cfg index e69de29..8c82632 100644 --- a/printer_data/config/CUSTOM/chamber_heat.cfg +++ b/printer_data/config/CUSTOM/chamber_heat.cfg @@ -0,0 +1,105 @@ +[gcode_macro SET_CHAMBER_HEAT] +description: Modular chamber heating logic with active/passive support, includes safety checks and debug output + +# === OVERVIEW === +# This macro heats the chamber to a target temperature using either: +# 1. An active heater (like a dedicated chamber heater), or +# 2. Passive heating (using the bed heater). +# It controls the bed heater, an optional chamber heater, and a circulation fan. +# It will block until the target temperature is reached. + +# === SAFETY WARNINGS === +# - Ensure your chamber temperature sensor is correctly installed and reporting. +# - Watch your printer during the first few uses of this macro. +# - Passive mode may take a long time to reach temperature. +# - Don't overheat your enclosure — check max safe temps for your printer! + +# === PARAMETERS === +# TARGET : (required) Target chamber temperature in °C. +# SENSOR : (optional) Temperature sensor name (default: temperature_sensor chamber_combined_mean). +# HEATER : (optional) Chamber heater name (used only if ACTIVE=True). +# BED_HEATER : (optional) Bed heater name (default: heater_bed). +# FAN : (optional) Circulation fan name (default: nevermore_fan). +# ACTIVE : (optional) If True, uses a dedicated heater; otherwise uses passive heating. + +# === USAGE === +# SET_CHAMBER_HEAT TARGET=60 ACTIVE=True HEATER="heater_generic chamber_heater" +# SET_CHAMBER_HEAT TARGET=60 ACTIVE=False + +# === OVERVIEW === +# Heats the chamber using: +# 🔥 Active: Chamber heater + bed + fan +# ❄️ Passive: Bed heater only +# ✅ Blocks until desired temperature is reached + +gcode: + # === 🎛️ Parse Parameters === + {% set target = params.TARGET|int %} + {% set sensor = params.SENSOR|default('temperature_sensor chamber_combined_mean') %} + {% set heater = params.HEATER|default('') %} + {% set bed_heater = params.BED_HEATER|default('heater_bed') %} + {% set bed_fan = params.FAN|default('nevermore_fan') %} + {% set active = params.ACTIVE|default("false")|lower == 'true' %} + {% set wait_temp = target if active else target - 25 %} + + {% set msg = "🧰 [CHAMBER HEAT] Init | Target: " ~ target ~ "°C | Wait until: " ~ wait_temp ~ "°C | Mode: " ~ ("🔥 Active" if active else "❄️ Passive") %} + RESPOND MSG="{msg}" + + M141 S{target} # Set virtual chamber temp for slicers + + # === 🔥 ACTIVE MODE === + {% if active %} + {% set msg = "🔥 [CHAMBER HEAT] Enabling active mode: chamber heater + bed + fan at full speed!" %} + RESPOND MSG="{msg}" + + {% if heater|length > 0 %} + {% set msg = "🛠️ [CHAMBER HEAT] Chamber heater '" ~ heater ~ "' → " ~ target|string ~ "°C" %} + RESPOND MSG="{msg}" + SET_HEATER_TEMPERATURE HEATER={heater} TARGET={target} + {% endif %} + + {% set msg = "🛏️ [CHAMBER HEAT] Bed heater '" ~ bed_heater ~ "' → " ~ target|string ~ "°C (support heat)" %} + RESPOND MSG="{msg}" + SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET={target} + + {% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 100%" %} + RESPOND MSG="{msg}" + SET_FAN_SPEED FAN={bed_fan} SPEED=1.0 + + # === ❄️ PASSIVE MODE === + {% else %} + {% if printer[sensor].temperature < wait_temp %} + {% set msg = "❄️ [CHAMBER HEAT] Chamber is cool (" ~ printer[sensor].temperature|round(1) ~ "°C) — warming with bed only!" %} + RESPOND MSG="{msg}" + + {% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 50% (gentle circulation)" %} + RESPOND MSG="{msg}" + SET_FAN_SPEED FAN={bed_fan} SPEED=0.5 + + {% set msg = "🛏️ [CHAMBER HEAT] Bed heater '" ~ bed_heater ~ "' → 120°C (passive heating boost)" %} + RESPOND MSG="{msg}" + SET_HEATER_TEMPERATURE HEATER={bed_heater} TARGET=120 + + {% set msg = "⏳ [CHAMBER HEAT] Waiting for bed to reach 120°C..." %} + RESPOND MSG="{msg}" + TEMPERATURE_WAIT SENSOR="{bed_heater}" MINIMUM=120 + + {% else %} + {% set msg = "✅ [CHAMBER HEAT] Chamber already warm (" ~ printer[sensor].temperature|round(1) ~ "°C), skipping passive heat!" %} + RESPOND MSG="{msg}" + {% endif %} + + {% set msg = "🌀 [CHAMBER HEAT] Fan '" ~ bed_fan ~ "' → speed = 100%" %} + RESPOND MSG="{msg}" + SET_FAN_SPEED FAN={bed_fan} SPEED=1.0 + {% endif %} + + # === ⏳ FINAL BLOCKING WAIT === + {% set msg = "⏳ [CHAMBER HEAT] Waiting for chamber sensor '" ~ sensor ~ "' ≥ " ~ wait_temp ~ "°C..." %} + RESPOND MSG="{msg}" + TEMPERATURE_WAIT SENSOR="{sensor}" MINIMUM={wait_temp} + + {% set msg = "🎉 [CHAMBER HEAT] Chamber ready! Final temp: " ~ printer[sensor].temperature|round(1) ~ "°C" %} + RESPOND MSG="{msg}" + +