-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
266 lines (242 loc) · 9.5 KB
/
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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Incluimos las macros oficiales de mainsail
[include mainsail.cfg]
# Incluimos las macros del paquete KAMP_LiTE
[include kamp-lite/*.cfg]
# Incluimos las macros de Demon Klippper Essentials Unified
[include demon-klipper/*.cfg]
# Incluimos la redefinicion de las variables
[include variables.cfg]
#############################
### OVERRIDE DEMON MACROS ###
#############################
[gcode_macro LOAD_FILAMENT]
gcode:
{% set clean_vars = printer["gcode_macro _CLEAN_VARIABLES"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set temp = params.TEMP|default(180)|int %}
{% set cool = params.COOL|default('No')|string %}
{% set cool_temp = params.COOL_TEMP|default(160)|int %}
{% if printer.print_stats.state in ['printing', 'paused'] or clean_vars.have_you_set_this_up != True %}
_LOAD_FILAMENT SPEED_MMsec={speed} TEMP={temp} COOL={cool} COOL_TEMP={cool_temp}
{% else %}
LOAD_CLEAN SPEED_MMsec={speed} TEMP={temp}
{% endif %}
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set clean_vars = printer["gcode_macro _CLEAN_VARIABLES"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set temp = params.TEMP|default(180)|int %}
{% set cool = params.COOL|default('No')|string %}
{% set cool_temp = params.COOL_TEMP|default(160)|int %}
{% if printer.print_stats.state in ['printing', 'paused'] or clean_vars.have_you_set_this_up != True %}
_UNLOAD_FILAMENT SPEED_MMsec={speed} TEMP={temp} COOL={cool} COOL_TEMP={cool_temp}
{% else %}
UNLOAD_CLEAN SPEED_MMsec={speed} TEMP={temp}
{% endif %}
[gcode_macro _CUSTOM_PRE_LOAD]
gcode:
BEEP R=1
[gcode_macro _CUSTOM_PRE_LOAD_CLEAN]
gcode:
BEEP R=1
[gcode_macro _CUSTOM_PRE_UNLOAD]
gcode:
BEEP R=1
[gcode_macro _CUSTOM_PRE_UNLOAD_CLEAN]
gcode:
BEEP R=1
[gcode_macro _CUSTOM_POST_LOAD]
gcode:
SET_DISPLAY_TEXT MSG="Filament has been loaded"
RESPOND TYPE=COMMAND MSG="Filament has been loaded"
BEEP R=2
[gcode_macro _CUSTOM_POST_LOAD_CLEAN]
gcode:
SET_DISPLAY_TEXT MSG="Filament has been loaded"
RESPOND TYPE=COMMAND MSG="Filament has been loaded"
BEEP R=2
[gcode_macro _CUSTOM_POST_UNLOAD]
gcode:
SET_DISPLAY_TEXT MSG="Filament has been unloaded"
RESPOND TYPE=COMMAND MSG="Filament has been unloaded"
BEEP R=2
[gcode_macro _CUSTOM_POST_UNLOAD_CLEAN]
gcode:
SET_DISPLAY_TEXT MSG="Filament has been unloaded"
RESPOND TYPE=COMMAND MSG="Filament has been unloaded"
BEEP R=2
[gcode_macro _FIL_CHANGE_PARK]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
SET_DISPLAY_TEXT MSG="Moving to filament change position"
RESPOND TYPE=COMMAND MSG="Moving to filament change position"
PAUSE X={start_vars.filament_change_park_x} Y={start_vars.filament_change_park_y} Z_MIN={start_vars.filament_change_park_min_z} RESTORE=0
_SAVE
UNLOAD_FILAMENT
[gcode_macro _INITIAL_SETUP]
gcode:
# Assign feed rate according to a Demon variable (default value is 100)
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
M220 S{start_vars.feed_rate}
RESPOND TYPE=COMMAND MSG="_INITIAL_SETUP: Ignoring flow rate and pa from Demon to get slicer values"
[gcode_macro _LOAD_FILAMENT]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set ceal = printer["gcode_macro CUSTOM_EXPANSION_ACTIVE_LIST"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set temp = params.TEMP|default(250)|int %}
{% set cool = params.COOL|default('No')|string %}
{% set cool_temp = params.COOL_TEMP|default(160)|int %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
SAVE_GCODE_STATE NAME=load_state
_ENCODER_FEED_CHECK_PREP
M400
{% if ceal.ceal_master_enable == True %}
{% if ceal.pre_load == True %}
_CUSTOM_PRE_LOAD {rawparams}
{% endif %}
{% endif %}
{% if printer.print_stats.state not in ['printing', 'paused'] %}
SET_DISPLAY_TEXT MSG="Load hotend heating..."
RESPOND TYPE=COMMAND MSG="Load hotend heating..."
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={temp|int -2} MAXIMUM={temp|int + 5}
M117
{% endif %}
SET_DISPLAY_TEXT MSG="Loading filament..."
RESPOND TYPE=COMMAND MSG="Loading filament..."
M83
G92 E0
G1 E{start_vars.load_length} F{max_velocity}
M400
_ENCODER_FEED_CHECK
G1 E{start_vars.load_purge_length} F{speed}
{% if cool in ['Yes', 'yes', 'True', 'true']|string %}
{% if printer.print_stats.state not in ['printing', 'paused'] and (temp >= printer.configfile.settings['extruder'].min_extrude_temp) %}
SET_DISPLAY_TEXT MSG="Post load hotend cooling..."
RESPOND TYPE=COMMAND MSG="Post load hotend cooling..."
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={cool_temp}
M117
{% elif printer.print_stats.state in ['printing', 'paused'] %}
SET_DISPLAY_TEXT MSG="Load cooling denied, print in progress!"
RESPOND TYPE=COMMAND MSG="Load cooling denied, print in progress!"
{% endif %}
{% endif %}
{% if ceal.ceal_master_enable == True %}
{% if ceal.post_load == True %}
_CUSTOM_POST_LOAD {rawparams}
{% endif %}
{% endif %}
RESTORE_GCODE_STATE NAME=load_state
[gcode_macro _UNLOAD_FILAMENT]
gcode:
{% set start_vars = printer["gcode_macro _START_VARIABLES"] %}
{% set ceal = printer["gcode_macro CUSTOM_EXPANSION_ACTIVE_LIST"] %}
{% set speed = params.SPEED_MMsec|default(7)|float * 60 %}
{% set temp = params.TEMP|default(250)|int %}
{% set cool = params.COOL|default('No')|string %}
{% set cool_temp = params.COOL_TEMP|default(160)|int %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
_MAX_EXTRUDE_CHECK
SAVE_GCODE_STATE NAME=unload_state
_ENCODER_FEED_CHECK_PREP
M400
{% if ceal.ceal_master_enable == True %}
{% if ceal.pre_unload == True %}
_CUSTOM_PRE_UNLOAD {rawparams}
{% endif %}
{% endif %}
{% if printer.print_stats.state not in ['printing', 'paused'] %}
SET_DISPLAY_TEXT MSG="Unload hotend heating..."
RESPOND TYPE=COMMAND MSG="Unload hotend heating..."
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={temp}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={temp|int -2} MAXIMUM={temp|int + 5}
M117
{% endif %}
SET_DISPLAY_TEXT MSG="Unloading filament..."
RESPOND TYPE=COMMAND MSG="Unloading filament..."
M83
G92 E0
G1 E{start_vars.unload_purge_length} F{speed}
M400
_ENCODER_FEED_CHECK
G1 E-5 F{max_velocity}
G4 P8000
G1 E-{start_vars.unload_length} F{max_velocity}
{% if cool in ['Yes', 'yes', 'True', 'true']|string %}
{% if printer.print_stats.state not in ['printing', 'paused'] and (temp >= printer.configfile.settings['extruder'].min_extrude_temp) %}
SET_DISPLAY_TEXT MSG="Post unload hotend cooling..."
RESPOND TYPE=COMMAND MSG="Post unload hotend cooling..."
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={cool_temp}
M117
{% elif printer.print_stats.state in ['printing', 'paused'] %}
SET_DISPLAY_TEXT MSG="Unload cooling denied, print in progress!"
RESPOND TYPE=COMMAND MSG="Unload cooling denied, print in progress!"
{% endif %}
{% endif %}
{% if ceal.ceal_master_enable == True %}
{% if ceal.post_unload == True %}
_CUSTOM_POST_UNLOAD {rawparams}
{% endif %}
{% endif %}
RESTORE_GCODE_STATE NAME=unload_state
#######################
### PERSONAL MACROS ###
#######################
### BEEP
# Usage: BEEP [R=<number of beeps>]
[gcode_macro BEEP]
description: Performs R beep (default is 1)
gcode:
{% if 'output_pin beeper' in printer.configfile.settings and printer["gcode_macro M300"] is defined %}
{% set R = params.R|default(1)|int %}
{% for i in range(R) %}
M300 P200
G4 P100
{% endfor %}
{% endif %}
### INPUT_SHAPER_TEST
# Usage: INPUT_SHAPER_TEST
[gcode_macro INPUT_SHAPER_TEST]
description: Configure Klipper to perform the input shaper test
gcode:
SET_DISPLAY_TEXT MSG="Setting Klipper to perform the input shaper test"
RESPOND TYPE=COMMAND MSG="Setting Klipper to perform the input shaper test"
RESPOND TYPE=COMMAND MSG="Remember to set max_accel: 3000 in your printer.cfg"
SET_VELOCITY_LIMIT MINIMUM_CRUISE_RATIO=0
SET_PRESSURE_ADVANCE ADVANCE=0
{% if printer.configfile.config["input_shaper"] is defined %}
RESPOND TYPE=COMMAND MSG="Input shaper already configured. Setting it to zero"
SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0
{% endif %}
TUNING_TOWER COMMAND=SET_VELOCITY_LIMIT PARAMETER=ACCEL START=600 STEP_DELTA=300 STEP_HEIGHT=5
SET_DISPLAY_TEXT MSG="Klipper is now configured to print the input shaper test"
RESPOND TYPE=COMMAND MSG="Klipper is now configured to print the input shaper test"
### M300
# Usage: M300 [P=<beep duration in ms>]
[gcode_macro M300]
description: Performs a beep with a duration of P ms (default is 100 ms)
gcode:
{% set P = params.P|default(100)|float %}
SET_PIN PIN=beeper VALUE=1
G4 P{P}
SET_PIN PIN=beeper VALUE=0
### PUBLISH_ALERT
# Usage: PUBLISH_ALERT [PAYLOAD=<payload>]
[gcode_macro PUBLISH_ALERT]
description: Publish a MQTT message with topic 'klipper/alert'
gcode:
{% set data = params.PAYLOAD|default(None) %}
{action_call_remote_method("publish_mqtt_topic",
topic="klipper/alert",
payload=data,
qos=0,
retain=False,
use_prefix=False)}
### TOTAL_SHUTDOWN
# Usage: TOTAL_SHUTDOWN
[gcode_macro TOTAL_SHUTDOWN]
description: Shutdown the Raspberry Pi in a controlled way, and then the 3D printer
gcode:
PUBLISH_ALERT PAYLOAD="TotalShutdown"