-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
353 lines (314 loc) · 13.3 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
########################################
# Macro configuration
########################################
[idle_timeout]
timeout: 259200 # 3 jours (72*60*60 secondes)
[delayed_gcode manage_fans]
initial_duration: 0.1
gcode:
{% set sysstate = printer["idle_timeout"] %}
{% if sysstate.state == "Printing" %}
{% set chambersensor = printer["temperature_sensor Chambre"] %}
{% set capotfanspeed = (chambersensor.temperature*2.3)/100 %}
{% if capotfanspeed > 1 %}
{% set capotfanspeed = 1 %}
{% endif %}
{% if capotfanspeed < 0 %}
{% set capotfanspeed = 0 %}
{% endif %}
SET_FAN_SPEED FAN=_Capot SPEED={capotfanspeed}
{% endif %}
{% set alimsensor = printer["temperature_sensor Alimentation"] %}
{% if alimsensor.temperature > 45 %}
{% set alimfanspeed = (alimsensor.temperature*1.8)/100 %}
{% else %}
{% set alimfanspeed = (alimsensor.temperature*1.3)/100 %}
{% endif %}
{% if alimfanspeed > 1 %}
{% set alimfanspeed = 1 %}
{% endif %}
{% if alimfanspeed < 0.3 %}
{% set alimfanspeed = 0.3 %}
{% endif %}
SET_FAN_SPEED FAN=_Alimentation SPEED={alimfanspeed}
UPDATE_DELAYED_GCODE ID=manage_fans DURATION=15
[delayed_gcode load_bedmesh]
initial_duration: 1
gcode:
BED_MESH_PROFILE LOAD=default
[gcode_macro T0]
description: Avoid display a warning if slicer put T0 in gcode
gcode:
[gcode_macro CHARGER_FILAMENT]
description: Charger un filament en chauffant la tête puis en extrudant 150mm de fil à 220°C.
gcode: LOAD_FILAMENT
[gcode_macro LOAD_FILAMENT]
gcode:
{% if not printer.pause_resume.is_paused %}
M109 S220
{% endif %}
M83
G92 E0.0
G0 E150 F300
G92 E0.0
M82
{% if not printer.pause_resume.is_paused %}
M84
{% endif %}
[gcode_macro EJECTER_FILAMENT]
description: Ejecter un filament en chauffant la tête puis en retractant 150mm de fil à 220°C.
gcode: UNLOAD_FILAMENT
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% if not printer.pause_resume.is_paused %}
M109 S220
{% endif %}
M83
G92 E0.0
G0 E-150 F300
G92 E0.0
M82
{% if not printer.pause_resume.is_paused %}
M84
{% endif %}
[gcode_macro ETALONNAGE_COMPLET]
description: Etalonnage complet de la machine, Parallélisme + Surface + Chauffe tête + Chauffe lit.
gcode:
G28
QUAD_GANTRY_LEVEL
BED_MESH_CALIBRATE PROFILE=default
PID_CALIBRATE HEATER=extruder TARGET=220
PID_CALIBRATE HEATER=heater_bed TARGET=80
SAVE_CONFIG
[gcode_macro ETALONNAGE_PARALLELISME]
description: Etalonnage du parallélisme des 4 axes Z.
gcode:
G28
QUAD_GANTRY_LEVEL
[gcode_macro ETALONNAGE_SURFACE]
description: Etalonnage de Surface du lit.
gcode:
G28
BED_MESH_CALIBRATE PROFILE=default
[gcode_macro ETALONNAGE_TETE]
description: Etalonnage de la chauffe de la tête (PID : important).
gcode:
PID_CALIBRATE HEATER=extruder TARGET=230
SAVE_CONFIG
[gcode_macro ETALONNAGE_LIT]
description: Etalonnage de la chauffe du lit (PID : important).
gcode:
PID_CALIBRATE HEATER=heater_bed TARGET=80
SAVE_CONFIG
[gcode_macro Palpeur_ON]
description: Sortir le palpeur
gcode: SET_PIN PIN=Palpeur VALUE=1 # Probe deploy command
[gcode_macro Palpeur_OFF]
description: Rentrer le palpeur
gcode: SET_PIN PIN=Palpeur VALUE=0 # Probe stow command
[gcode_macro START_PRINT]
description: Start a new running print
gcode:
BED_MESH_PROFILE LOAD=default
SET_LED LED="Eclairage_LEDs" RED=1 GREEN=1 BLUE=1 SYNC=0 TRANSMIT=1
[gcode_macro END_PRINT]
gcode:
SET_LED LED="Eclairage_LEDs" RED=0 GREEN=0 BLUE=1 SYNC=0 TRANSMIT=1
[gcode_macro CALIBRATION_ZV]
description: Lancer une calibration de l'Input Shaping avec l'accéléromètre. ATTENTION : ne pas lancer cette procédure trop souvent, la machine étant soumise à de fortes vibrations durant le test.
gcode:
G28
G1 Z20
G4 S5
SHAPER_CALIBRATE AXIS=X
SHAPER_CALIBRATE AXIS=Y
SAVE_CONFIG
[gcode_macro ETEINDRE_MOTEURS]
description: Eteindre les moteurs qui sont sous tension.
gcode:
M84
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
SET_LED LED="Eclairage_LEDs" RED=1 GREEN=0 BLUE=0 SYNC=0 TRANSMIT=1
##### get user parameters or use default #####
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set allow_park = False if not macro_found
else False if client.park_at_cancel is not defined
else True if client.park_at_cancel|lower == 'true'
else False %}
{% set retract = 5.0 if not macro_found else client.cancel_retract|default(5.0)|abs %}
##### define park position #####
{% set park_x = "" if not macro_found
else "" if client.park_at_cancel_x is not defined
else "X=" + client.park_at_cancel_x|string if client.park_at_cancel_x is not none %}
{% set park_y = "" if not macro_found
else "" if client.park_at_cancel_y is not defined
else "Y=" + client.park_at_cancel_y|string if client.park_at_cancel_y is not none %}
{% set custom_park = True if (park_x|length > 0 or park_y|length > 0) else False %}
##### end of definitions #####
# {% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %}
{% if (not printer.pause_resume.is_paused) %} _TOOLHEAD_PARK_PAUSE_CANCEL {% endif %}
_CLIENT_RETRACT LENGTH={retract}
TURN_OFF_HEATERS
M106 S0
# clear pause_next_layer and pause_at_layer as preparation for next print
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable': False, 'call':"PAUSE"}}"
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer': 0, 'call':"PAUSE"}}"
CANCEL_PRINT_BASE
{% set maxY = printer.configfile.config.stepper_y.position_max %}
G1 X1 Y{maxY} F9000
M84
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL {rawparams}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### get user parameters or use default #####
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
{% set sp_move = velocity if not macro_found else client.speed_move|default(velocity) %}
##### end of definitions #####
_CLIENT_EXTRUDE
RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}
# Usage: SET_PAUSE_NEXT_LAYER [MACRO=<name>]
[gcode_macro PAUSE_PROCHAINE_COUCHE]
description: Enable a pause if the next layer is reached
gcode: SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable':True, 'call':params.MACRO|default("PAUSE")}}"
# Usage: SET_PAUSE_AT_LAYER [LAYER=<number>] [MACRO=<name>]
[gcode_macro PAUSE_A_LA_COUCHE]
description: Enable/disable a pause if a given layer number is reached
gcode:
{% if params.LAYER is defined %}
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': True, 'layer':params.LAYER|int, 'call':params.MACRO|default("PAUSE")}}"
{% else %}
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer':0, 'call':"PAUSE"}}"
{% endif %}
# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=<total_layer_count>] [CURRENT_LAYER= <current_layer>]
[gcode_macro SET_PRINT_STATS_INFO]
rename_existing: SET_PRINT_STATS_INFO_BASE
description: Overwrite, to get pause_next_layer and pause_at_layer feature
variable_pause_next_layer: {'enable':False, 'call':"PAUSE"}
variable_pause_at_layer : {'enable':False, 'layer':0, 'call':"PAUSE"}
gcode:
{% if pause_next_layer.enable %}
{action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)}
{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{'enable': False, 'call':"PAUSE"}}"
{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
{action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))}
{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{'enable': False, 'layer': 0, 'call':"PAUSE"}}"
{% endif %}
SET_PRINT_STATS_INFO_BASE {rawparams}
##### internal use #####
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
gcode:
##### get user parameters or use default #####
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
{% set use_custom = False if not macro_found
else False if client.use_custom_pos is not defined
else True if client.use_custom_pos|lower == 'true'
else False %}
{% set custom_park_x = 0.0 if not macro_found else client.custom_park_x|default(0.0) %}
{% set custom_park_y = 0.0 if not macro_found else client.custom_park_y|default(0.0) %}
{% set park_dz = 10.0 if not macro_found else client.custom_park_dz|default(2.0)|abs %}
{% set sp_hop = 900 if not macro_found else client.speed_hop|default(15) * 60 %}
{% set sp_move = velocity * 60 if not macro_found else client.speed_move|default(velocity) * 60 %}
##### get config and toolhead values #####
{% set origin = printer.gcode_move.homing_origin %}
{% set act = printer.gcode_move.gcode_position %}
{% set max = printer.toolhead.axis_maximum %}
{% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta
{% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch']
else False %}
##### define park position #####
{% set z_min = params.Z_MIN|default(0)|float %}
{% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origin.z)]|min %}
{% set x_park = params.X if params.X is defined
else custom_park_x if use_custom
else 0.0 if round_bed
else (max.x - 5.0) %}
{% set y_park = params.Y if params.Y is defined
else custom_park_y if use_custom
else (max.y - 5.0) if round_bed and z_park < cone
else 0.0 if round_bed
else (max.y - 5.0) %}
##### end of definitions #####
_CLIENT_RETRACT
# {% if "xyz" in printer.toolhead.homed_axes %}
# G90
# G1 Z{z_park} F{sp_hop}
# G1 X{x_park} Y{y_park} F{sp_move}
# {% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
# {% else %}
# {action_respond_info("Printer not homed")}
# {% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G90
G1 Z{z_park} F600
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro _CLIENT_EXTRUDE]
description: Extrudes, if the extruder is hot enough
gcode:
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set use_fw_retract = False if not macro_found
else False if client.use_fw_retract is not defined
else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined
else False %}
{% set length = (params.LENGTH|float) if params.LENGTH is defined
else 1.0 if not macro_found
else client.unretract|default(1.0) %}
{% set speed = params.SPEED if params.SPEED is defined
else 35 if not macro_found
else client.speed_unretract|default(35) %}
{% set absolute_extrude = printer.gcode_move.absolute_extrude %}
{% if printer.extruder.can_extrude %}
{% if use_fw_retract %}
{% if length < 0 %}
G10
{% else %}
G11
{% endif %}
{% else %}
M83
G1 E{length} F{(speed|float|abs) * 60}
{% if absolute_extrude %}
M82
{% endif %}
{% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
[gcode_macro _CLIENT_RETRACT]
description: Retracts, if the extruder is hot enough
gcode:
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set length = (params.LENGTH|float) if params.LENGTH is defined
else 1.0 if not macro_found
else client.retract|default(1.0) %}
{% set speed = params.SPEED if params.SPEED is defined
else 35 if not macro_found
else client.speed_retract|default(35) %}
_CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs}
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[pause_resume]
[display_status]