-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfan_macros.cfg
104 lines (91 loc) · 3.52 KB
/
fan_macros.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
########################################
## Fan Macros
########################################
# Start Pi temp monitoring loop.
[delayed_gcode skirt_fan_boot]
initial_duration: 1.0
gcode:
{% if printer.print_stats.state|lower != "printing" %}
SET_FAN_SPEED FAN=controller_fan SPEED=0.5
{% else %}
SET_FAN_SPEED FAN=controller_fan SPEED=0.3 #just so I can see if this is getting called
{% endif %}
UPDATE_DELAYED_GCODE ID=skirt_fan DURATION=5
# Pi temperature monitoring loop. Check temp every 5 minutes & turn on skirt fans if too hot. Turn off if cool.
[delayed_gcode skirt_fan]
gcode:
{% if printer.print_stats.state|lower != "printing" %}
{% if printer['temperature_sensor RPi'].temperature >= 50 %}
SET_FAN_SPEED FAN=controller_fan SPEED=0.3
{% elif printer['temperature_sensor RPi'].temperature < 40 %}
SET_FAN_SPEED FAN=controller_fan SPEED=0
{% endif %}
{% else %}
SET_FAN_SPEED FAN=controller_fan SPEED=0.3
{% endif %}
UPDATE_DELAYED_GCODE ID=skirt_fan DURATION=300
## dummy output to get an switch in Mainsail
## any unused mcu pin can be defined you will not connect anything
## as I use the rPi as mcu I will use a pin from it
## Off -> M106 will update fan
## On -> M106 can not uodate fan
[output_pin lock_M106]
pin: rpi: gpio16
value:0
# M106 with lock and manual set feature
# M106 S128 M1 will update the fan in any case
[gcode_macro M106]
description: set fan with manual override and lock option
rename_existing: M106.1
gcode:
{% if printer['output_pin lock_M106'].value|int == 0 or params.M|default(0) == '1' %}
M106.1 {rawparams}
{% else %}
{action_respond_info("M106 update is locked")}
{% endif %}
[gcode_macro M141]
description: Set temperature of chamber fan
gcode: SET_TEMPERATURE_FAN_TARGET temperature_fan=chamber target={params.S|default(0)}
[gcode_macro _SET_FILTER]
description: Helper: Set Filter filter speed
gcode: SET_FAN_SPEED FAN=filter SPEED={params.S|default(0)}
[gcode_macro _FILTER_ON]
description: Helper: Filter on
gcode: _SET_FILTER S={printer['gcode_macro _USER_VARIABLE'].peripheral.filter.on_val}
[gcode_macro FILTER]
description: Toggle Filter fan
gcode:
{% if printer['fan_generic filter'].speed|float > 0.0 %} _SET_FILTER {% else %} _FILTER_ON {% endif %}
_FILTER_INFO
[delayed_gcode _DELAY_FILTER_OFF]
gcode:
{% if printer.print_stats.state|lower != "paused" and printer.print_stats.state|lower != "printing" %}
_SET_FILTER
_FILTER_INFO
{% endif %}
## Chamber Ventilation Control in Mainsail
[gcode_macro VENT]
description: Toggle Chamber fan
gcode:
{% if printer['temperature_fan chamber'].target|float > 0 and
printer['temperature_fan chamber'].target|float <= printer['gcode_macro _USER_VARIABLE'].peripheral.vent.on_val|float %}
M141
{% else %}
M141 S{printer['gcode_macro _USER_VARIABLE'].peripheral.vent.on_val}
{% endif %}
_VENT_INFO
[delayed_gcode _DELAY_VENT_OFF]
gcode:
{% if printer.print_stats.state|lower != "paused" and printer.print_stats.state|lower != "printing" %}
M141
_VENT_INFO
{% endif %}
[gcode_macro _VENT_INFO]
description: Helper: Print chamber fan temperature
gcode:
{% set txt = "off" if printer['temperature_fan chamber'].target == 0
else "target temp: %2dC" % printer['temperature_fan chamber'].target %}
{action_respond_info("Chamber fan %s" % txt)}
[gcode_macro _FILTER_INFO]
description: Helper: Print Filter speed
gcode: {action_respond_info("Filter fan %s" % 'on' if printer['fan_generic filter'].speed|float > 0.0 else 'off')}