-
Notifications
You must be signed in to change notification settings - Fork 0
/
macros.cfg
265 lines (230 loc) · 13.3 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
#####################################################################
# Macros
#####################################################################
[pause_resume]
#recover_velocity: 50.
# When capture/restore is enabled, the speed at which to return to
# the captured position (in mm/s). Default is 50.0 mm/s.
[delayed_gcode DISABLEFILAMENTSENSOR]
initial_duration: 1
gcode:
SET_FILAMENT_SENSOR SENSOR=SFS_Motion ENABLE=0
SET_FILAMENT_SENSOR SENSOR=SFS_Switch ENABLE=0
[gcode_macro G32]
gcode:
BED_MESH_CLEAR
G28
QUAD_GANTRY_LEVEL
G28
G0 X150 Y150 Z30 F3600
[gcode_macro M600]
gcode:
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-50 F1000
G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: BASE_QUAD_GANTRY_LEVEL
gcode:
SET_DISPLAY_TEXT MSG="QGL"
STATUS_LEVELING
{% if "z" not in printer.toolhead.homed_axes %} ; Home if needed
G28
{% endif %}
BASE_QUAD_GANTRY_LEVEL
G28 Z
SMART_PARK
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
# Parameters
{% set z = params.Z|default(10)|int %} ; z hop amount
{% if printer['pause_resume'].is_paused|int == 0 %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
SET_FILAMENT_SENSOR SENSOR=SFS_Motion ENABLE=0 ; disable filament sensor
SET_FILAMENT_SENSOR SENSOR=SFS_Switch ENABLE=0 ; disable filament sensor
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
BASE_PAUSE ; pause print
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
G91 ; relative positioning
G1 Z{z} F900 ; raise Z up by z hop amount
{% else %}
{ action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
{% endif %}
G90 ; absolute positioning
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
#M104 S0 ; turn off hotend
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
{% endif %}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
variable_zhop: 0
variable_etemp: 0
gcode:
# Parameters
{% set e = params.E|default(2.5)|int %}
{% if printer['pause_resume'].is_paused|int == 1 %}
SET_FILAMENT_SENSOR SENSOR=SFS_Motion ENABLE=1 ; enable filament sensor
SET_FILAMENT_SENSOR SENSOR=SFS_Switch ENABLE=1 ; enable filament sensor
#RESETRGB ; reset LCD color
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
{% if etemp > 0 %}
M109 S{etemp|int} ; wait for hotend to heat back up
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
G91 ; relative positioning
M83 ; relative extruder positioning
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
{% else %}
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
{% endif %}
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
BASE_RESUME ; resume print
{% endif %}
[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 + 20, 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 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
M107 ; turn off fan
SET_FAN_SPEED FAN=nevermore SPEED=0
BED_MESH_CLEAR
SET_FILAMENT_SENSOR SENSOR=SFS_Motion ENABLE=0 ; disable filament sensor
SET_FILAMENT_SENSOR SENSOR=SFS_Switch ENABLE=0 ; disable filament sensor
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
CLEAR_PAUSE
#SDCARD_RESET_FILE
PRINT_END
BASE_CANCEL_PRINT
[gcode_macro OFF]
gcode:
M84 ; turn steppers off
TURN_OFF_HEATERS ; turn bed / hotend off
M107 ; turn print cooling fan off
#SET_FAN_SPEED FAN=Exhaust SPEED=0 ; turn exhaust fan off
#SET_FAN_SPEED FAN=BedFans SPEED=0 ; bed fan off
SET_PIN PIN=caselight VALUE=0 ; turn case light off
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
SAVE_GCODE_STATE NAME=UNLOADFILAMENT
M83 ; set extruder to relative
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
M109 S225 ; Heats the nozzle to temp
G1 E10 F600 ; extrude a little to soften tip
G1 E-120 F1800 ; retract filament completely
RESTORE_GCODE_STATE NAME=UNLOADFILAMENT
{action_call_remote_method(
"spoolman_set_active_spool",
spool_id=None
)}
[gcode_macro LOAD_FILAMENT]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
SAVE_GCODE_STATE NAME=LOADFILAMENT
M83 ; set extruder to relative
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
M109 S225 ; Heats the nozzle to temp
G1 E150 F300
RESTORE_GCODE_STATE NAME=LOADFILAMENT
#####################################################################
# 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 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
G28 # Full home (XYZ)
G90 # Absolut position
## Uncomment for bed mesh (1 of 2)
BED_MESH_CLEAR # Clears old saved bed mesh (if any)
# 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_FAN_SPEED FAN=nevermore SPEED=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 5min" # Displays info
G4 P300000 # Waits 5 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 V2 (Quad gantry level AKA QGL)
SET_DISPLAY_TEXT MSG="QGL" # Displays info
STATUS_LEVELING # Sets SB-leds to leveling-mode
quad_gantry_level # 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
SMART_PARK # Smart Parking of Nozzle
# 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
# Gets ready to print by doing a purge line and updating the SB-leds
CLEAN_NOZZLE # Clean Nozzle again before printin
SET_DISPLAY_TEXT MSG="Printer goes brr" # Displays info
STATUS_PRINTING # Sets SB-leds to printing-mode
LINE_PURGE # Start Line Purging
SET_FILAMENT_SENSOR SENSOR=SFS_Motion ENABLE=1 # enable filament sensor
SET_FILAMENT_SENSOR SENSOR=SFS_Switch ENABLE=1 # enable filament sensor
#ADAPTIVE_PURGE # Start adaptive Purging
#G0 X{x_wait - 50} Y4 F10000 # Moves to starting point
#G0 Z0.4 # Raises Z to 0.4
#G91 # Incremental positioning
#G1 X100 E20 F1000 # Purge line
#G90 # Absolut position