-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
250 lines (212 loc) · 9.84 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
#####################################################################
# Macros
#####################################################################
#####################################################################
# print_start macro
#####################################################################
## *** THINGS TO UNCOMMENT: ***
## Bed mesh (2 lines at 2 locations)
## Screw_tilt_adjust if your printer is a Trident
## Quad gantry level if your printer is a V2
## Nevermore - if you have one
[gcode_macro DEBUG]
gcode:
# This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer.
{% set target_bed = params.BED|int %}
{% set target_extruder = params.EXTRUDER|int %}
{% set target_chamber = params.CHAMBER|default("40")|int %}
{% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %}
SET_DISPLAY_TEXT MSG="x_wait: {x_waiy}"
[gcode_macro PRINT_START]
gcode:
# This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer.
{% set target_bed = params.BED|int %}
{% set target_extruder = params.EXTRUDER|int %}
{% set target_chamber = params.CHAMBER|default("40")|int %}
{% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %}
{% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %}
# Homes the printer, sets absolute positioning and updates the Stealthburner leds.
STATUS_HOMING # Sets SB-leds to homing-mode
_CG28 # Full home (XYZ)
G90 # Absolut position
## Uncomment for bed mesh (1 of 2)
SETUP_KAMP_MESHING DISPLAY_PARAMETERS=1 LED_ENABLE=1 FUZZ_ENABLE=1
SETUP_VORON_PURGE DISPLAY_PARAMETERS=1 ADAPTIVE_ENABLE=1
BED_MESH_CLEAR
# Checks if the bed temp is higher than 90c - if so then trigger a heatsoak.
{% if params.BED|int > 90 %}
SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
M106 S255 # Turns on the PT-fan
## Uncomment if you have a Nevermore.
#SET_PIN PIN=nevermore VALUE=1 # Turns on the nevermore
G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed
M190 S{target_bed} # Sets the target temp for the bed
SET_DISPLAY_TEXT MSG="Heatsoak: {target_chamber}c" # Displays info
#TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_chamber} # Waits for chamber to reach desired temp
# If the bed temp is not over 90c, then it skips the heatsoak and just heats up to set temp with a 5min soak
{% else %}
SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed
M190 S{target_bed} # Sets the target temp for the bed
SET_DISPLAY_TEXT MSG="Soak for 1min" # Displays info
G4 P60000 # Waits 1 min for the bedtemp to stabilize
{% endif %}
# Heating nozzle to 150 degrees. This helps with getting a correct Z-home
SET_DISPLAY_TEXT MSG="Hotend: 150c" # Displays info
M109 S150 # Heats the nozzle to 150c
## Uncomment for Trident (screw_tilt_adjust)
#SET_DISPLAY_TEXT MSG="Z-tilt adjust" # Displays info
#STATUS_LEVELING # Sets SB-leds to leveling-mode
#Z_TILT_ADJUST # Levels the buildplate via z_tilt_adjust
#G28 Z # Homes Z again after z_tilt_adjust
## Uncomment for V2 (Quad gantry level AKA QGL)
SET_DISPLAY_TEXT MSG="QGL" # Displays info
STATUS_LEVELING # Sets SB-leds to leveling-mode
_CQGL # Levels the buildplate via QGL
G28 Z # Homes Z again after QGL
## Uncomment for Klicky auto-z
#CALIBRATE_Z # Calibrates Z-offset with klicky
#SET_DISPLAY_TEXT MSG="Z-offset" # Displays info
## Uncomment for bed mesh (2 of 2)
SET_DISPLAY_TEXT MSG="Bed mesh" # Displays info
STATUS_MESHING # Sets SB-leds to bed mesh-mode
BED_MESH_CALIBRATE # Starts bed mesh
# Heats up the nozzle up to target via data from slicer
SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}c" # Displays info
STATUS_HEATING # Sets SB-leds to heating-mode
G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed
M107 # Turns off partcooling fan
M109 S{target_extruder} # Heats the nozzle to printing temp
# SET_DISPLAY_TEXT MSG="Voron purge..." # Displays info
# VORON_PURGE
# Gets ready to print by doing a purge line and updating the SB-leds
SET_DISPLAY_TEXT MSG="Printing..." # Displays info
STATUS_PRINTING # Sets SB-leds to printing-mode
G0 X{x_wait - 45} Y5 F10000 # Moves to starting point
G0 Z0.4 # Raises Z to 0.4
G91 # Incremental positioning
G1 X75 E15 F1000 # Purge line
G90 # Absolut position
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
[gcode_macro PRINT_END]
gcode:
# safe anti-stringing move coords
{% set th = printer.toolhead %}
{% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
{% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
{% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
SAVE_GCODE_STATE NAME=STATE_PRINT_END
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-5.0 F1800 ; retract filament
TURN_OFF_HEATERS
G90 ; absolute positioning
#G0 X175 Y175 Z30 F3600
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
# #G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear
#G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y//2} F3600 ; park nozzle at center
G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 30} F3600 ; park nozzle at rear
M107 ; turn off fan
#BED_MESH_CLEAR
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
[gcode_macro _CG28]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
[gcode_macro _CQGL]
gcode:
{% if printer.quad_gantry_level.applied == False %}
{% if "xyz" not in printer.toolhead.homed_axes %}
G28 ; home if not already homed
{% endif %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
[gcode_macro LOAD_FILAMENT]
gcode:
M83 ; set extruder to relative
G1 E30 F300 ; load
G1 E15 F150 ; prime nozzle with filament
M82 ; set extruder to absolute
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-40 F1800 ; retract some, but not too much or it will jam
M82 ; set extruder to absolute
[gcode_macro _HOME_X]
gcode:
G28 X
[gcode_macro _HOME_Y]
gcode:
G28 Y
# [gcode_macro HOME_XY]
# gcode:
# M114 Homing XY
# ; lower current so we don't do much harm when we crash going away from home
# {% set HOME_CUR = 0.20 %}
# SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
# SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
# M400
# G91 # incremental
# ; First, move away from the back-right.
# G0 x-10 y-10 F300
# M400
# {% set HOME_CUR = 0.8 %}
# SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
# SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
# ; Wake the motors. They get weird if you don't do a move first after changing the current.
# M400
# G0 X+3 y+3 F600
# M400
# G90
# ; Now that we have space...
# ; Home X.
# G28 X0
# G4 P2000 ; wait for stall register to clear
# M400
# G91
# G0 X-20
# G90
# M400
# G28 Y0
# G4 P2000 ; wait for stall register to clear4
# # the following move is to ensure that we don't accidentally knock off the probe if it
# # happens to be on at the time XY homing is invoked.
# G0 Y{printer.toolhead.axis_maximum.y-20}
# M400
# M114
[gcode_macro m201]
gcode:
{% if 'X' in params or 'Y' in params %}
{% set accel = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_VELOCITY_LIMIT ACCEL={accel} ACCEL_TO_DECEL={accel * 0.5}
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro m203]
gcode:
{% if 'X' in params or 'Y' in params %}
{% set speed = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_VELOCITY_LIMIT VELOCITY={speed}
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro M205]
gcode:
{% if 'X' in params or 'Y' in params %}
{% set corner_speed = (params.X|default(params.Y)|float,
params.Y|default(params.X)|float)|min %}
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={corner_speed}
{% else %}
SET_VELOCITY_LIMIT
{% endif %}
[gcode_macro M900]
gcode:
SET_PRESSURE_ADVANCE ADVANCE={params.K}