Skip to content

Commit

Permalink
actually made it work
Browse files Browse the repository at this point in the history
  • Loading branch information
strayr committed Dec 10, 2023
1 parent 8eda69a commit 4a4cb1c
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions enclosure.cfg
Expand Up @@ -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
Expand Down Expand Up @@ -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 %}

Expand All @@ -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,
Expand All @@ -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") }
Expand All @@ -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



Expand Down

0 comments on commit 4a4cb1c

Please sign in to comment.