-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfan_control.cfg
135 lines (123 loc) · 4.5 KB
/
fan_control.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
########################################
# Fans Control
########################################
[respond]
[duplicate_pin_override]
pins: PC0, PC5, PB2, PC6, ADC_TEMPERATURE
[temperature_fan soc_fan]
pin: PB2
cycle_time: 0.0100
kick_start_time: 0.5
hardware_pwm: false
max_power: 1
shutdown_speed: 0
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
control: watermark
max_delta: 2
target_temp: 45.0
max_speed: 1.0
min_speed: 0.0
tachometer_pin:PC6
[heater_generic chamber]
heater_pin:PA0
max_power:1.0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: watermark
max_delta: 1
min_temp:-100
max_temp:65
[verify_heater chamber]
max_error: 900
check_gain_time: 300
hysteresis: 50
heating_gain: 1
[gcode_macro M141]
gcode:
{% if printer["heater_generic chamber"] is defined %}
{% set s = params.S|float %}
SET_HEATER_TEMPERATURE HEATER=chamber TARGET={params.S|default(0)}
{% endif %}
[gcode_macro M191]
description: Wait for Chamber Temperature to heat up
gcode:
{% set s = params.S|float %}
{% set chamber_temp = printer["heater_generic chamber"].temperature|float %}
{% if s > 0 %}
M141 S{s}
{% endif %}
{% if s > chamber_temp and s <= 65 %}
M140 S100
M106 P2 S210 # подключение боковой улитки для лучшей конвекции в камере
RESPOND TYPE=command MSG="Waiting for the bed to heat up the chamber..."
TEMPERATURE_WAIT SENSOR="heater_generic chamber" MINIMUM={s-2}
RESPOND TYPE=command MSG="Chamber target temperature reached: {s}°C"
M107 P2 S0 # отключение улитки при достижении нужной температуры
M140 S{s}
{% endif %}
[gcode_macro M106]
gcode:
{% set fans = printer["gcode_macro PRINTER_PARAM"].fans|int %}
{% set fan = 0 %}
{% set value = 0 %}
{% if params.P is defined %}
{% set tmp = params.P|int %}
{% if tmp < fans %}
{% set fan = tmp %}
{% endif %}
{% endif %}
{% if params.S is defined %}
{% set tmp = params.S|float %}
{% else %}
{% set tmp = 255 %}
{% endif %}
{% if tmp > 0 %}
{% if fan == 0 %}
{% set value = (255 - printer["gcode_macro PRINTER_PARAM"].fan0_min) / 255 * tmp %}
{% if printer['gcode_macro Qmode'].flag | int == 1 %}
SET_GCODE_VARIABLE MACRO=Qmode VARIABLE=fan0_value VALUE={printer["gcode_macro PRINTER_PARAM"].fan0_min + value}
{% if value > (255 - printer['gcode_macro PRINTER_PARAM'].fan0_min) / 2 %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan0_min + (255 - printer['gcode_macro PRINTER_PARAM'].fan0_min) / 2 %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan0_min + value %}
{% endif %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan0_min + value %}
{% endif %}
{% endif %}
{% if fan == 1 %}
{% set value = (255 - printer["gcode_macro PRINTER_PARAM"].fan1_min) / 255 * tmp %}
{% if printer['gcode_macro Qmode'].flag | int == 1 %}
SET_GCODE_VARIABLE MACRO=Qmode VARIABLE=fan1_value VALUE={printer["gcode_macro PRINTER_PARAM"].fan1_min + value}
{% if value > (255 - printer['gcode_macro PRINTER_PARAM'].fan1_min) / 2 %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan1_min + (255 - printer['gcode_macro PRINTER_PARAM'].fan1_min) / 2 %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan1_min + value %}
{% endif %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan1_min + value %}
{% endif %}
{% endif %}
{% if fan == 2 %}
{% set value = (255 - printer["gcode_macro PRINTER_PARAM"].fan2_min) / 255 * tmp %}
{% if printer['gcode_macro Qmode'].flag | int == 1 %}
SET_GCODE_VARIABLE MACRO=Qmode VARIABLE=fan2_value VALUE={printer["gcode_macro PRINTER_PARAM"].fan2_min + value}
{% if value > (255 - printer['gcode_macro PRINTER_PARAM'].fan2_min) / 2 %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan2_min + (255 - printer['gcode_macro PRINTER_PARAM'].fan2_min) / 2 %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan2_min + value %}
{% endif %}
{% else %}
{% set value = printer["gcode_macro PRINTER_PARAM"].fan2_min + value %}
{% endif %}
{% endif %}
{% endif %}
{% if value >= 255 %}
{% set value = 255 %}
{% endif %}
{% if params.P is defined and params.P|int == 3 %}
{% set fan = 1 %}
{% endif %}
SET_PIN PIN=fan{fan} VALUE={value}