-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcp_macro.cfg
333 lines (289 loc) · 8.39 KB
/
cp_macro.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
[pause_resume]
[display_status]
[virtual_sdcard]
path: ~/printer_1_data/gcodes
#Change this parameter according to which printer you are using in ChromaPad.
#Example: 3rd printer "path: ~/printer_3_data/gcodes"
#[bed_screws]
#You can change these values according to the size of your printer and verify manually.
#screw1: 30, 30
#screw2: 150, 30
#screw3: 30, 150
#screw4: 150, 150
[gcode_macro LOAD_FILAMENT]
gcode:
M83
G1 E100 F300
M118
[gcode_macro PARK_FILAMENT]
gcode:
M83
G1 E-100 F300
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set z_park_delta = 2.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
FILAMENT_CUT
G91
G1 E-78
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro END_PRINT]
gcode:
{% set x_stop = params.X|default(printer.toolhead.axis_maximum.x-5)|int %}
{% set y_stop = params.Y|default(printer.toolhead.axis_maximum.y-5)|int %}
{% set z_stop = printer.toolhead.axis_maximum.z|int %}
{% set z_pos = printer.toolhead.position.z|int %}
{% if z_pos < (z_stop-6) %}
G91
G1 E-2 F2700
G1 Z5
{% else %}
G91
G1 E-2 F2700
G1 Z1
{% endif %}
FILAMENT_CUT
G1 E-78
G90
G1 X{x_stop} Y{y_stop}
M106 S0
M104 S0
M140 S0
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER = params.EXTRUDER|default(0)|int %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %}
{% set axismax = printer.toolhead.axis_maximum %}
{% set axismin_x = printer.toolhead.axis_minimum.x %}
{% set axismin_y = printer.toolhead.axis_minimum.y %}
# Home the printer
G28
# Heat bed for probing
M190 S{BED_TEMP}
# Use absolute coordinates
G90
BED_MESH_PROFILE LOAD=default
G1 Z10 F450
M109 S{EXTRUDER_TEMP}
T{EXTRUDER}
{% if axismax.x > 196 %}
G92 E0
G1 X0 Y152 Z0.4 F900
G92 E0
G1 Y77 E20 F900
G92 E0
G1 Y2 E20 F900
G92 E0
G1 X98 E30 F900
G92 E0
G1 X196 E30 F900
G92 E0
G1 Y4 F900
G92 E0
G1 X98 E30 F900
G92 E0
G1 X2 E30 F900
G92 E0
G1 Y77 E20 F900
G92 E0
G1 Y152 E20 F900
G92 E0 ;Reset Extruder
{% else %}
{% if axismax.y > 153 %}
G92 E0 ;Reset Extruder
G1 X{axismin_x + 2} Y152 Z0.4 F900 ;Move to start position
G92 E0
G1 Y77 E20 F900 ;Draw the first line
G92 E0
G1 Y2 E20 F900 ;Draw the first line
G92 E0
G1 X{axismax.x / 2} E30 F900 ;Draw the first line
G92 E0
G1 X{axismax.x - 2} E30 F900 ;Draw the first line
G92 E0
G1 Y{axismin_y + 4} F900 ;Draw the first line
G92 E0
G1 X{axismax.x / 2} E30 F900 ;Draw the first line
G92 E0
G1 X{axismin_x + 4} E30 F900 ;Draw the first line
G92 E0
G1 Y77 E20 F900 ;Draw the first line
G92 E0
G1 Y152 E20 F900
G92 E0
{% else %}
G92 E0 ;Reset Extruder
G1 X{axismin_x + 2} Y{axismax.Y - 2} Z0.4 F900 ;Move to start position
G92 E0
G1 Y{axismax.Y / 2} E20 F900 ;Draw the first line
G92 E0
G1 Y2 E20 F900 ;Draw the first line
G92 E0
G1 X{axismax.x / 2} E30 F900 ;Draw the first line
G92 E0
G1 X{axismax.x - 2} E30 F900 ;Draw the first line
G92 E0
G1 Y{axismin_y + 4} F900 ;Draw the first line
G92 E0
G1 X{axismax.x / 2} E30 F900 ;Draw the first line
G92 E0
G1 X{axismin_x + 4} E30 F900 ;Draw the first line
G92 E0
G1 Y{axismax.Y / 2} E20 F900 ;Draw the first line
G92 E0
G1 Y{axismax.Y - 2} E20 F900
G92 E0
{% endif %}
{% endif %}
G92 E0 ;Reset Extruder
[exclude_object]
#The following code should be added to the start gcode section of the slicer application used.
#start_print EXTRUDER=[initial_extruder] EXTRUDER_TEMP=[nozzle_temperature_initial_layer] BED_TEMP=[bed_temperature_initial_layer_single]
[respond]
default_type: echo
default_prefix:
[gcode_macro SET_FILAMENT_POSITION]
gcode:
RESPOND TYPE=command MSG="action:prompt_begin Set Filament Position"
RESPOND TYPE=command MSG="action:prompt_text Make sure the extruder is sufficiently heated and the correct extruder is selected."
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button T0|T0|primary"
RESPOND TYPE=command MSG="action:prompt_button T1|T1|primary"
RESPOND TYPE=command MSG="action:prompt_button T2|T2|primary"
RESPOND TYPE=command MSG="action:prompt_button T3|T3|primary"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_button_group_start"
RESPOND TYPE=command MSG="action:prompt_button EXTRUDE|EXTRUDE_H|warning"
RESPOND TYPE=command MSG="action:prompt_button SET|SET_FILAMENT|warning"
RESPOND TYPE=command MSG="action:prompt_button_group_end"
RESPOND TYPE=command MSG="action:prompt_show"
[gcode_macro EXTRUDE_H]
gcode:
{% set temperature = printer.extruder.temperature|int %}
{% if temperature > 199 %}
G92 E0
G1 E20 F500
G92 E0
G1 E20 F500
G92 E0
G1 E20 F500
G92 E0
G1 E20 F500
G92 E0
G1 E20 F500
G92 E0
{% endif %}
[gcode_macro SET_FILAMENT]
gcode:
FILAMENT_CUT
G92 E0
G1 E-20 F500
G92 E0
G1 E-20 F500
G92 E0
G1 E-20 F500
G92 E0
G1 E-20 F500
G92 E0
[gcode_macro FILAMENT_CHANGE]
gcode:
{% set LAYER_NUM = params.LAYER_NUM|int %}
{% set NEXT_EXTRUDER = params.NEXT_EXTRUDER|int %}
{% if LAYER_NUM == -1 %}
{% endif %}
{% if LAYER_NUM != -1 %}
{LAYER_NUM}
FILAMENT_CUT
G4 P300
G91
G1 X10 E-20 F300
G92 E0
G1 X-20 E-30 F500
G92 E0
G1 X10 E-30 F600
T{NEXT_EXTRUDER}
G92 E0
G1 X-10 E20 F500
G92 E0
G1 X10 E20 F300
G92 E0
G1 X-10 E20 F300
G92 E0
G1 X10 E20 F300
G90
{% endif %}
# FILAMENT_CHANGE LAYER_NUM=[layer_num] NEXT_EXTRUDER=[next_extruder]
[gcode_macro G3]
gcode:
G4 P0
[gcode_macro G17]
gcode:
G4 P0