-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebui_macros.cfg
338 lines (312 loc) · 10.3 KB
/
webui_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
[include speedtest.cfg]
[pause_resume]
[gcode_macro timelapse_after]
gcode:
{% set P = params.PATH|default(lala) %}
RESPOND PREFIX=lala MSG={ P }
RESPOND PREFIX=lala_raw MSG={ rawparams }
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% set E = params.E|default(1)|int %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 5.0) %}
{% set z_safe = 5.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F2100
G1 Z{z_safe} F900
G90
G0 X{x_park} Y{y_park} F6000
G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
{% set E = params.E|default(1)|int %}
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
{% set E = params.E|default(1)|int %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 5.0) %}
{% set z_safe = 5.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
G91
G1 E-{E} F2100
G1 Z{z_safe} F900
G90
G0 X{x_park} Y{y_park} F6000
G91
TURN_OFF_HEATERS
M107 ; turn off fan
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
[gcode_macro START_PRINT]
variable_ext_temp: 200
gcode:
{% set BED_TEMP = params.BED_TEMP|default(80)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(210)|int %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 1.0 %}
{% set y_park = printer.toolhead.axis_minimum.y|float + 1.0 %}
{% set z_park = printer.toolhead.axis_minimum.z %}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=ext_temp VALUE={EXTRUDER_TEMP}
# Start bed heating
M140 S{BED_TEMP}
M117 Heating bed
{% set extrTemp = printer.configfile.settings.extruder.min_extrude_temp|int + 10 %}
{% if printer.extruder.can_extrude|lower == 'false' %}
M109 S{extrTemp} ; heat extruder and wait
{% else %}
M104 S{extrTemp}
{% endif %}
# Use absolute coordinates
G90
# Home the printer
G28
# Move the nozzle out of the bed
G1 X{x_park} Y{y_park} F3000
# Move the nozzle down
G1 Z0 F120
M190 S{BED_TEMP}
_WAIT_PWM
[gcode_macro _PRINT_START2]
gcode:
{% set x_park = printer.toolhead.axis_minimum.x|float + 1.0 %}
{% set y_park = printer.toolhead.axis_minimum.y|float + 1.0 %}
#CLEAN_NOZZLE
# Home the printer
G28 Z
# Move the nozzle out of the bed
G1 X{x_park} Y{y_park} F3000
# Move the nozzle down
G1 Z0 F120
M117 Heating extruder
{% set ext_temp = printer["gcode_macro START_PRINT"].ext_temp %}
M104 S{ext_temp}
M109 S{ext_temp}
BED_MESH_LOAD
_PRIME_LINE
M117 Printing
[gcode_macro PRINT_END]
gcode:
{% set E = params.E|default(1)|int %}
{% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 5.0) %}
{% set z_safe = 5.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
G91
G1 E-{E} F2100
G1 Z{z_safe} F900
G90
G0 X{x_park} Y{y_park} F6000
G91
TURN_OFF_HEATERS
M107 ; turn off fan
M84 X Y E ; disable motors
##########################
##########################
# [gcode_macro M900]
# default_parameter_K:0
# gcode:
# SET_PRESSURE_ADVANCE ADVANCE={K}
# SET_PRESSURE_ADVANCE SMOOTH_TIME=0.04
[gcode_macro POWER_OFF_PRINTER]
gcode:
{action_call_remote_method("set_device_power", device="printer", state="off")}
[gcode_macro timelapse]
gcode:
RESPOND PREFIX=timelapse MSG=photo
## use: WAIT_PWM S=0.50
[gcode_macro _WAIT_PWM]
variable_pwm: 0.35
variable_first: 'true'
gcode:
# first execution?
{% set S = params.S|default(0.7)|float %}
{% if printer["gcode_macro _WAIT_PWM"].first == 'true'%}
{% if printer['heater_bed'].power|float > S|float %}
# store variables
SET_GCODE_VARIABLE MACRO=_WAIT_PWM VARIABLE=first VALUE='"false"'
SET_GCODE_VARIABLE MACRO=_WAIT_PWM VARIABLE=pwm VALUE={S|float}
# execute wait
BASE_PAUSE
UPDATE_DELAYED_GCODE ID=_DELAY_PWM DURATION=1
{% else %}
_PRINT_START2
{% endif %}
{% else %}
# done
SET_GCODE_VARIABLE MACRO=_WAIT_PWM VARIABLE=first VALUE='"true"'
BASE_RESUME
_PRINT_START2
{% endif %}
[delayed_gcode _DELAY_PWM]
gcode:
# only done to increase readability
{% set pwm = printer["gcode_macro _WAIT_PWM"].pwm %}
{% set act = printer['heater_bed'].power %}
# check what to do
{% if act|float > pwm|float %}
UPDATE_DELAYED_GCODE ID=_DELAY_PWM DURATION=1
{% else %}
_WAIT_PWM
{% endif %}
[gcode_macro _PRIME_LINE]
gcode:
# define values for easiermodification
{% set seg = 10 %}
{% set lenght = printer.toolhead.axis_maximum.y|float - 10.0 %}
{% set extrude = 15 %}
;SAVE_GCODE_STATE NAME=STATE_PRIME_LINE
# calculate values of each segment
{% set y_seg = lenght|float / seg|float %}
{% set e_seg = extrude|float / seg|float %}
M117 Prime Line
G90 ; absolute positioning
M83 ; extruder relative mode
G1 E4 F1200.0 ; some filament for cleanup
G1 Z0.24 F240 ; move Z Axis
G1 Y5 E5 F1200.0 ; move with extrusion to line start
G92 E0
G1 Y200 E15 F1500 ; intro line
G1 X0.3 F5000
G92 E0
G1 Y20 E15 F1200 ; intro line
G92 E0
;G1 Z1.0 F1200 ; move Z Axis up
G1 X0.4 ; move to side
G90 ; absolute positioning
G1 Y40.0 F1200 ;
;RESTORE_GCODE_STATE NAME=STATE_PRIME_LINE
[gcode_macro BED_MESH_LOAD]
description: Load an existing mesh or generate a new one
gcode:
##### set default parameter value #####
{% set auto = params.AUTO|default('false') %}
{% set bed_temp = printer.heater_bed.target|int %}
##### join everything to a single mesh name #####
{% set mesh_name = "mesh_" + bed_temp|string %}
##### end of definitions #####
{% if printer.configfile.config["bed_mesh " + mesh_name] is defined %}
BED_MESH_CLEAR
BED_MESH_PROFILE LOAD={mesh_name}
M117 "{"BED_MESH: " + mesh_name + " loaded"}"
{% else %}
BED_MESH_CLEAR
BED_MESH_PROFILE LOAD=default
M117 no mesh avaluable, default
{% endif %}
[gcode_macro _FILAMENT_BALL]
description: Helper: Round the filament tip
gcode:
##### set default parameter value #####
{% set wait = params.WAIT|default(0) %}
##### end of definitions #####
SAVE_GCODE_STATE NAME=STATE_FILAMENT_BALL
# Ball up the filament tip
G92 E0 ; zero the extruder
M82 ; absolute extrusion
G1 E2 F2900
G1 E0 F2900
G1 E4 F2900
G1 E0 F2900
G1 E8 F2900
G1 E0 F2900
M83 ; relative extrusion
G1 E-25 F1800
G4 P{wait|int * 1000}
RESTORE_GCODE_STATE NAME=STATE_FILAMENT_BALL
[gcode_macro FILAMENT_LOAD]
description: Load filament and disable rounout while running
gcode:
##### get user defines #####
{% set pre_load = 30 %}
{% set minTemp = params.MINTMP|default(230)|float %}
{% set load = params.LOAD|default(50)|int %}
{% set extrude = params.EXTRUDE|default(80)|int %}
{% set retreact = 2 %}
{% set purge_x = printer.toolhead.axis_minimum.x|float + 1.0 %}
{% set purge_y = printer.toolhead.axis_minimum.y|float + 1.0 %}
{% set purge_z = printer.toolhead.axis_minimum.z + 0.5%}
##### store extruder temps #####
{% set extruder_target = printer.extruder.target %}
##### end of definitions #####
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
SAVE_GCODE_STATE NAME=STATE_LOAD_FILAMENT
{% if printer.extruder.temperature < minTemp %}
{action_respond_info("Extruder Temp to low, heat to %2dC" % minTemp)}
M109 S{minTemp} ; heat extruder and wait
{% else %}
M104 S{minTemp} ; heat extruder
{% endif %}
# Load a bit to put filament in gear
M83
G1 E{pre_load} F600
## Move to waste bin
M104 S{minTemp}
G28 ; home
G90 ; absolute positioning
G1 X{purge_x} Y{purge_y} F1800 ; move to purge bucket location
G1 Z{purge_z} F240 ; move head to minimum
G1 E{load} F600 ; quickly load 90mm filament
G1 E{extrude} F300 ; slower extrusion for hotend path
G1 E{retreact} F800 ; retract
# restore old extruder temperature
M109 S{extruder_target}
M117 Filament loaded
RESTORE_GCODE_STATE NAME=STATE_LOAD_FILAMENT
{% else %}
M117 Filament loading disabled while printing!
{% endif %}
[gcode_macro FILAMENT_UNLOAD]
description: Unload filament and disable rounout while running
gcode:
##### get user defines #####
{% set minTemp = params.MINTMP|default(230)|float %}
{% set unload = params.UNLOAD|default(80)|int %}
##### store extruder temps #####
{% set extruder_target = printer.extruder.target %}
##### end of definitions #####
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
SAVE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
{% if printer.extruder.temperature < minTemp %}
{action_respond_info("Extruder Temp to low, heat to %2dC" % minTemp)}
M109 S{minTemp} ; heat extruder and wait
{% else %}
M104 S{minTemp} ; heat extruder
{% endif %}
# Ball up the filament tip and retract out past the extruder gears
#_FILAMENT_BALL WAIT=3
M83 ; Relative extrusion
G1 E-{unload} F900
M400
# restore old extruder temperature
M109 S{extruder_target}
M117 Filament unloaded
RESTORE_GCODE_STATE NAME=STATE_UNLOAD_FILAMENT
{% else %}
M117 Filament unloading disabled while printing!
{% endif %}