From 4a4cb1c82e6c4f4bbc95cc57f91eaa2760fd4abd Mon Sep 17 00:00:00 2001 From: Rowland Straylight Date: Sat, 17 Dec 2022 23:25:36 +0000 Subject: [PATCH] actually made it work --- enclosure.cfg | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/enclosure.cfg b/enclosure.cfg index efa1837..dd45229 100644 --- a/enclosure.cfg +++ b/enclosure.cfg @@ -37,11 +37,7 @@ shutdown_speed: 1 description: use parameters ENABLE=1 to enable fan/printlight management. ON=1 for normal use, ON=0 or OFF=1 for instantant off COOLDOWN=1 for temperatue based cooldown. PREHEAT=1 for accelerated warmup. gcode: {% set svv = printer.save_variables.variables %} - {% if (svv.enclosure_cooldown > 0) %} - { action_respond_info("COOLDOWN is active") } - SET_FAN_SPEED FAN=filter SPEED={svv.enclosure_filterspeed} - # SET_FAN_SPEED FAN=exhaust SPEED={svv.enclosure_exhaustspeed} - {% endif %} + {% if (params.ENABLE|default(-1)|int > 0) %} SAVE_VARIABLE VARIABLE=enclosure_enable VALUE=1 @@ -85,6 +81,7 @@ gcode: SET_FAN_SPEED FAN=filter SPEED={svv.enclosure_filterspeed} SET_FAN_SPEED FAN=exhaust SPEED={svv.enclosure_exhaustspeed} SAVE_VARIABLE VARIABLE=enclosure_cooldown VALUE=1 + UPDATE_DELAYED_GCODE ID=enclosure_cooldown DURATION=30 { action_respond_info("Cooldown active") } {% endif %} @@ -94,11 +91,16 @@ gcode: { action_respond_info("Cooldown disabled, fans may still be running") } {% endif %} - # move this to enable logic - {% if "enabled" in params %} + {% if ('enabled' in params|lower) %} { action_respond_info("Use ENABLE=1 to use enclosure cooling") } {% endif%} - M300 + + {% if ('query' in params|lower ) %} + { action_respond_info("ENABLE: " + svv.enclosure_enable|string ) } + { action_respond_info("COOLDOWN: " + svv.enclosure_cooldown|string ) } + { action_respond_info("EXHAUST: " + svv.enclosure_exhaustspeed|string ) } + { action_respond_info("FILTER: " + svv.enclosure_filterspeed|string ) } + {% endif%} [gcode_macro _ENCLOSURE_COOLDOWN_WATCHDOG] description: checks every 30 seconds to see if the bed and extruder are below TARGET temperature, @@ -113,18 +115,17 @@ gcode: { action_respond_info("Fans will stop when bed cools to " + my_target|string +"C") } {% endif %} - SET_GCODE_VARIABLE MACRO=BED_COOLING_ALARM VARIABLE=cycles VALUE={cycles + 1} + SET_GCODE_VARIABLE MACRO=_ENCLOSURE_COOLDOWN_WATCHDOG VARIABLE=cycles VALUE={cycles + 1} {% if printer.heater_bed.temperature < my_target %} - SET_ENCLOSURE off=1 - #_SOUND_ALARM SAVE_VARIABLE VARIABLE=enclosure_cooldown VALUE=0 + SET_ENCLOSURE off=1 { action_respond_info("Bed has cooled below " + my_target|string +"C") } #{ action_respond_info("Alarm performed " + cycles|string +" cycles") } #debug - SET_GCODE_VARIABLE MACRO=_ENCLOSURE_COOLDOWN_WATCHDOG VARIABLE=target VALUE=40 - SET_GCODE_VARIABLE MACRO=_ENCLOSURE_COOLDOWN_WATCHDOG VARIABLE=cycles VALUE={0} + #SET_GCODE_VARIABLE MACRO=_ENCLOSURE_COOLDOWN_WATCHDOG VARIABLE=target VALUE=40 + SET_GCODE_VARIABLE MACRO=_ENCLOSURE_COOLDOWN_WATCHDOG VARIABLE=cycles VALUE=0 M117 Enclosure Cool {% else %} - UPDATE_DELAYED_GCODE ID=cooling_helper DURATION=30 + UPDATE_DELAYED_GCODE ID=enclosure_cooldown DURATION=30 {% endif %} {% else %} { action_respond_info("Cooldown disabled") } @@ -135,10 +136,18 @@ gcode: [delayed_gcode enclosure_cooldown] -initial_duration: 5 gcode: _ENCLOSURE_COOLDOWN_WATCHDOG +[delayed_gcode enclosure_startup] +initial_duration: 5 +gcode: + {% if ((svv.enclosure_cooldown > 0) and (svv.enclosure_enable > 0)) %} + { action_respond_info("COOLDOWN set active") } + SET_FAN_SPEED FAN=filter SPEED={svv.enclosure_filterspeed} + SET_FAN_SPEED FAN=exhaust SPEED={svv.enclosure_exhaustspeed} + {% endif %} + _ENCLOSURE_COOLDOWN_WATCHDOG