-
Notifications
You must be signed in to change notification settings - Fork 11
/
fan_delay.cfg
61 lines (49 loc) · 1.77 KB
/
fan_delay.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[gcode_macro FAN_DELAY]
#
# FAN_DELAY
#
# Run a given fan for a given amount of time at a given power. If no power is specified, just turn it off after a given delay
description: Run a specified FAN for DELAY seconds at POWER. If no power is specified, just shut FAN off after DELAY
gcode:
{% set fan = params.FAN|string %}
{% set delay = params.DELAY|default(300)|float %}
{% set power = params.POWER|default(0)|float %}
SET_GCODE_VARIABLE MACRO=DISABLE_FAN VARIABLE=fan VALUE='"{fan}"'
{% if power > 0 %}
M118 Setting {fan} to {power} for {delay}s
SET_FAN_SPEED FAN={fan} SPEED={power}
{% endif %}
UPDATE_DELAYED_GCODE ID=_DISABLE_FAN_DELAY DURATION={delay}
[gcode_macro DISABLE_FAN]
variable_fan: ''
gcode:
SET_FAN_SPEED FAN={fan} SPEED=0
[delayed_gcode _DISABLE_FAN_DELAY]
initial_duration: 0
gcode:
DISABLE_FAN
[gcode_macro FAN_DELAY2]
#
# FAN_DELAY
#
# Run a given fan for a given amount of time at a given power. If no power is specified, just turn it off after a given delay
# This is a copy of FAN_DELAY so you can run two FAN_DELAYs simultaneously (yeah, it's a dirty hack!)
description: (Secondary) Run a specified FAN for DELAY seconds at POWER. If no power is specified, just shut FAN off after DELAY
gcode:
{% set fan = params.FAN|string %}
{% set delay = params.DELAY|default(300)|float %}
{% set power = params.POWER|default(0)|float %}
SET_GCODE_VARIABLE MACRO=DISABLE_FAN2 VARIABLE=fan VALUE='"{fan}"'
{% if power > 0 %}
M118 Setting {fan} to {power} for {delay}s
SET_FAN_SPEED FAN={fan} SPEED={power}
{% endif %}
UPDATE_DELAYED_GCODE ID=_DISABLE_FAN_DELAY2 DURATION={delay}
[gcode_macro DISABLE_FAN2]
variable_fan: ''
gcode:
SET_FAN_SPEED FAN={fan} SPEED=0
[delayed_gcode _DISABLE_FAN_DELAY2]
initial_duration: 0
gcode:
DISABLE_FAN2