-
Notifications
You must be signed in to change notification settings - Fork 15
/
macros.cfg
247 lines (214 loc) · 6.93 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
# Macros for a modified Ender-3 v2 with Sprite Pro Extruder,
# CR Touch, with a 4.2.7 silent board
# Replace the slicer's custom start and end g-code scripts with
# START_PRINT BED_TEMP={material_bed_temperature_layer_0} EXTRUDER_TEMP={material_print_temperature_layer_0}
# and END_PRINT.
#=====================================================
# Prusa SLicer Settings
#=====================================================
# Untick the "Emit Temperature commands automatically" setting
#=====================================================
# START PRINT
#=====================================================
[gcode_macro START_PRINT]
gcode:
RESPOND MSG="Preparing to print"
# Get first-layer bed-temp from slicer
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
# Get first-layer extruder-temp from slicer
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
# Setup KAMP variables
SETUP_KAMP_MESHING DISPLAY_PARAMETERS=1 LED_ENABLE=1 FUZZ_ENABLE=1
SETUP_LINE_PURGE DISPLAY_PARAMETERS=1 ADAPTIVE_ENABLE=1 Z_HEIGHT=.3 PURGE_AMOUNT=20 LINE_LENGTH=25
G90 # use absolute coordinates
M83 # extruder relative mode
RESPOND MSG="Warming up for bed leveling"
M104 S170 # set extruder temp for bed leveling
M140 S{BED_TEMP} # set bed temp
M109 S170 # wait for bed leveling temp
M190 S{BED_TEMP} ; wait for bed temp
G28 # home all axis
# mesh bed
BED_MESH_CLEAR
RESPOND MSG="KAMP Adaptive Bed Meshing"
BED_MESH_CALIBRATE
RESPOND MSG="Heating to print temp"
M104 S{EXTRUDER_TEMP}# set extruder temp
G0 Z40 F240
RESPOND MSG="Clean bed and nozzle"
G0 X2 Y220 F3000 #Clean Nozzle and Bed
M109 S{EXTRUDER_TEMP} # wait for extruder temp
RESPOND MSG="KAMP Line Purge"
LINE_PURGE # purge nozzle
RESPOND MSG="Print Started"
#=====================================================
# END PRINT
#=====================================================
[gcode_macro END_PRINT]
gcode:
#Fix-up extruder
RESPOND MSG="Print Finished"
G91
G1 E-.5 Z0.2 F2400
G1 X5 Y5 F6000
G1 Z10
G90
#Present print
G1 Z{printer.toolhead.position.z + 10} F600
G1 X0 Y220 F6000
M106 S0
M104 S0
M140 S0
#Disable Steppers
M84 X Y E
#=====================================================
# BUILD THE BED MESH
#=====================================================
# G29 that does (1) home all (2) get bed mesh (3) move
# nozzle to corner so it doesnt ooze on the bed while heating up.
# Change save to "save=yourprinter_mesh" cant use default
[gcode_macro G29]
gcode:
G28
BED_MESH_CALIBRATE
G0 X0 Y0 Z10 F6000
BED_MESH_PROFILE save=default
#=====================================================
# PARK PRINTER
#=====================================================
[gcode_macro M125]
gcode:
SAVE_GCODE_STATE NAME=parking
M117 Parking toolhead
G91
G1 Z10 F600 # move up 5 mm
G90
G1 X5 Y225 F4000 # move to park position
RESTORE_GCODE_STATE NAME=parking
#======================================================
# LOAD FILAMENT
#======================================================
[gcode_macro Load_Filament]
gcode:
SAVE_GCODE_STATE NAME=loading_filament
M117 Loading Filament
M83
G92 E0.0
G1 E5 F200 # Load filament into sprite and prime 5mm
G92 E20
RESTORE_GCODE_STATE NAME=loading_filament
#======================================================
# UNLOAD FILAMENT
#======================================================
[gcode_macro Unload_Filament]
gcode:
SAVE_GCODE_STATE NAME=unloading_filament
M125 # park
M117 Unloading Filament
G91 # set relative
G1 E10 F100
G92 E0.0
G1 E-5 F3000 # Unload filament from sprite 5mm
G92 E-5
RESTORE_GCODE_STATE NAME=unloading_filament
#======================================================
# FILAMENT CHANGE
#======================================================
[gcode_macro Filament_Change]
gcode:
# Save the G-code state
SAVE_GCODE_STATE NAME=filament_change
# Move the extruder to the side
G1 X5 Y225 F4000
# Unload the filament
{% if printer.extruder.can_reverse %}
G91
G1 E-10 F100
G92 E0
G90
{% else %}
M117 Extruder cannot reverse
{% endif %}
# Wait for user interaction to confirm new roll of filament
M117 Please insert new filament and confirm
# Prime the nozzle with new filament
G91
G1 E10 F100
G92 E0
G1 E5 F200
G90
# Restore the G-code state
RESTORE_GCODE_STATE NAME=filament_change
#=====================================================
# PAUSE
#=====================================================
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
##### set defaults #####
{% set x = params.X|default(5) %} #edit to your park position
{% set y = params.Y|default(225) %} #edit to your park position
{% set z = params.Z|default(10)|float %} #edit to your park position
{% set e = params.E|default(1) %} #edit to your retract length
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% set lift_z = z|abs %}
{% if act_z < (max_z - lift_z) %}
{% set z_safe = lift_z %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
#=====================================================
# RESUME
#=====================================================
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### set defaults #####
{% set e = params.E|default(1) %} #edit to your retract length
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E{e} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
#=====================================================
# CANCEL
#=====================================================
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
G91 # Set to incremental mode
G0 Z10 F600 # raise extruder
G90 # Set back to absolute mode
TURN_OFF_HEATERS
G0 X5 Y220 # clear print
CLEAR_PAUSE
#SDCARD_RESET_FILE
BASE_CANCEL_PRINT