-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
283 lines (248 loc) · 12 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
##################################################################################
# Macros
##################################################################################
[gcode_macro PRINT_START]
gcode:
RESPOND MSG="Running PRINT_START"
# Parameters
{% set bedtemp = params.BED|int %}
{% set hotendtemp = params.HOTEND|int %}
{% set chambertemp = params.CHAMBER|default(0)|int %}
# Start sequence
M140 S{bedtemp} ; start heating bed to target temp
M104 S{170} ; start heating nozzle to safe no-ooze temp
# SET_LED LED=lights RED=0.7 GREEN=0.7 BLUE=0.7 ; medium brightness, white light
CG28 ; Ellis' conditonal home, only if needed
{% if printer['heater_bed'].temperature < (0.7 * bedtemp) %} ; if bed still cold, preliminary z_tilt_adjust
RESPOND MSG="Bed not hot, initial Z_Tilt_Adjust"
Z_TILT_ADJUST
{% endif %}
RESPOND MSG="Running CHAMBER_SOAK to {target_temp}"
CHAMBER_SOAK TARGET_TEMP={chambertemp} ; heatsoak to desired temp
RESPOND MSG="Waiting for bed to reach {bedtemp}"
M190 S{bedtemp} ; set & wait for bed temp
RESPOND MSG="Waiting for hotend to reach {hotendtemp}"
Z_TILT_ADJUST ; z_tilt_adjust
BED_MESH_CALIBRATE ADAPTIVE=1 ADAPTIVE_MARGIN=2 ; probe bed
M109 S{hotendtemp} ; set & wait for hotend temp
M117 $MR$:Printer Status|:Print is about to start
PURGE_NOZZLE_BRUSH ; smart purge line
NOZZLE_WIPE ; clean nozzle
# Commands required for SS/PS/Orca
M73 P0 R91
G21
G90
M83
RESPOND MSG="Starting Print"
[gcode_macro PURGE_LINE]
gcode:
RESPOND MSG="Purging"
G90
G0 Y0 X40 ; go to tongue of print bed
G1 Z0.2 F500.0 ; move bed to nozzle
G92 E0.0 ; reset extruder
G1 E5 F1000 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
G1 X80 E5.0 F1000.0 ; intro line 1
G1 Y0.3 ; move in a little
G92 E0.0 ; reset extruder
G1 X40 E2.0 F1000.0 ; second line
G92 E0.0 ; reset extruder
G1 E-0.4 F3600 ; retract filament
G92 E0.0 ; reset extruder
G1 Z0.4 ; move nozzle to prevent scratch
[gcode_macro PURGE_NOZZLE_BRUSH]
gcode:
RESPOND MSG="Purging"
G90
G0 X-13 Y55 F4000
G0 Z-1 F4000
G1 E5 F1000 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT
G1 E7 F100
G92 E0.0 ; reset extruder
G1 E-0.4 F3600 ; retract filament
G92 E0.0 ; reset extruder
G1 Z0.4 ; move nozzle to prevent scratch
[gcode_macro NOZZLE_WIPE]
gcode:
RESPOND MSG="Wiping Nozzle"
G90
G0 X-13 Y10 F2000 ; go nozzle brush XY
G0 Z-1 F4000 ; lower onto brush
G0 X-13 Y55 F8000 ; go back and forth quickly
G0 X-13 Y10 F8000 ;
G0 X-13 Y55 F8000 ;
G0 X-13 Y10 F8000 ;
G0 X-13 Y55 F8000 ;
G0 Z5 ; raise to safe height about brush
[gcode_macro PRINT_END]
gcode:
M400 ; wait for buffer to clear
RESPOND MSG="Running PRINT_END"
G92 E0 ; zero the extruder
G1 E-5.0 F3600 ; retract filament
G91 ; relative positioning
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 75) %}
{% set z_safe = 75.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
TURN_OFF_HEATERS
M107 ; turn off fan
G90 ; absolute positioning
G0 X60 Y{max_y} F3600 ; park nozzle at rear
# SET_LED LED=lights RED=0.00 GREEN=0.5 BLUE=0.00
[gcode_macro LOAD_FILAMENT]
gcode:
M109 S{250}
M83 ; set extruder to relative
G1 E30 F300 ; load
G1 E15 F150 ; prime nozzle with filament
G1 E15 F150 ; prime nozzle with filament
G1 E15 F150 ; prime nozzle with filament
G1 E15 F150 ; prime nozzle with filament
G1 E15 F150 ; prime nozzle with filament
G1 E15 F150 ; prime nozzle with filament
G1 E-5.0 F3600
M82 ; set extruder to absolute
[gcode_macro PARK_NOZZLE_WIPE]
gcode:
G90
G0 X-13 Y0 F2000 ; go nozzle brush XY
G0 Z-1 F4000
[gcode_macro UNLOAD_FILAMENT]
gcode:
M109 S{250}
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-50 F1800 ; retract some, but not too much or it will jam
M82 ; set extruder to absolute
[gcode_macro CG28]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
[gcode_macro PARK_TOOLHEAD_CENTER_XY]
gcode:
CG28
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
# park nozzle at center of X/Y
G0 X{max_x/2} Y{max_y/2} F3600
[gcode_macro CHAMBER_SOAK]
gcode:
{% set target_temp = params.TARGET_TEMP|default(40)|int %}
M140 S110 ; warm up bed
M104 S170
M106 S255 ; part cooling fan to 100% to distribute air
CG28 ; conditional home
Dock_Probe_Unlock
G0 Z3 F3600
PARK_TOOLHEAD_CENTER_XY
RESPOND MSG="Waiting for chamber to reach {target_temp|default(40)}"
TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_temp} ; wait for chamber temp to reach target
RESPOND MSG="Heat soak complete"
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
G92 E0 ; zero the extruder
G1 E-5.0 F3600 ; retract filament
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
variable_extrude: 1.0
gcode:
{% set E = printer["gcode_macro PAUSE"].extrude|float %} ; read E from pause macro
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} ; set park positon for x and y
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.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 - 75.0) %}
{% set z_safe = 75.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
# End of calculations
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} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
{% set E = printer["gcode_macro PAUSE"].extrude|float %} ; read E from pause macro
# Get VELOCITY parameter if specified
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
# End of calculations
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro PROBE_BED]
description: Calibrates Bed Mesh
gcode:
BED_MESH_CALIBRATE
# Convert Marlin linear advance (M900) commands to Klipper (SET_PRESSURE_ADVANCE) commands.
# For use with Marlin's linear advance calibration: https://marlinfw.org/tools/lin_advance/k-factor.html
[gcode_macro M900]
gcode:
# Parameters
{% set pa = params.K|float %}
SET_PRESSURE_ADVANCE ADVANCE={pa}
#[gcode_macro WHITE_LOW]
#gcode:
# SET_LED LED=lights RED=0.01 GREEN=0.01 BLUE=0.01
#[gcode_macro WHITE_MEDIUM]#
#gcode:
# SET_LED LED=lights RED=0.2 GREEN=0.2 BLUE=0.2
#[gcode_macro WHITE_HIGH]
#gcode:
# SET_LED LED=lights RED=1.0 GREEN=1.0 BLUE=1.0
#[gcode_macro RED_LOW]
#gcode:
# SET_LED LED=lights RED=0.01 GREEN=0.00 BLUE=0.00
#[gcode_macro RED_MEDIUM]
#gcode:
# SET_LED LED=lights RED=0.2 GREEN=0.0 BLUE=0.0
#[gcode_macro RED_HIGH]
#gcode:
# SET_LED LED=lights RED=1.0 GREEN=0.0 BLUE=0.0