-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathclient_macros.cfg
executable file
·229 lines (195 loc) · 5.32 KB
/
client_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
[gcode_macro START_PRINT]
gcode:
{% set T_BED = params.T_BED|default(60) %}
{% set T_EXTRUDER = params.T_EXTRUDER|default(215) %}
M83
# Use absolute coordinates but realative extrusions
G90
G92 E0 ; reset extruder distance
M117 Preheating bed...
# Start bed heating and continue
M140 S{T_BED}
{% if printer.heater_bed.temperature < params.T_BED|float*0.7 %}
M190 S{params.T_BED|float*0.7} # wait till 70% of target bed temp is reached, then continue
{% endif %}
M117 Heating...
M140 S{T_BED}
M109 S{T_EXTRUDER}
M190 S{T_BED}
M117 Homing...
G28
# Reset the G-Code Z offset (adjust Z offset if needed)
SET_GCODE_OFFSET Z=0.0 MOVE=1
# Use the bed mesh
BED_MESH_PROFILE LOAD=default
# Prime line
PRIME_LINE
M117 Printing...
[gcode_macro PRIME_LINE]
gcode:
M117 Priming the nozzle
G1 Z0.2 F240
G1 Y{ (range(0, 8) | random) * 0.64} F1200 ; Set random start Y between 0 and ~5mm
G1 X30 E6 F1200.0 ; pressure build up line
G1 X95 Z0.4 E9 F1500.0 ; intro line
G1 Z2 F3000 ; Move Z Axis up little
G1 X100 Z0.2 F3000.0 ; Move over and stick remainings to the bed
G92 E0 ; reset extruder distance
[gcode_macro END_PRINT]
gcode:
# Turn off bed, extruder, and fan
M140 S0
M104 S0
M106 S0
# Move nozzle away from print while retracting
G91
G1 X-2 Y-2 E-3 F300
# Raise nozzle by 10mm
G1 Z10 F600
G90
# Disable steppers
M84
[pause_resume]
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% set X = params.X|default(5) %}
{% set Y = params.Y|default(5) %}
{% set Z = params.Z|default(10) %}
{% set E = params.E|default(5) %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F1900
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
[gcode_macro CLEAR_PAUSE]
rename_existing: BASE_CLEAR_PAUSE
gcode:
{% set X = params.X|default(5) %}
{% set Y = params.Y|default(205) %}
{% set Z = params.Z|default(10) %}
{% set E = params.E|default(5) %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F1900
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
{% set E = params.E|default(5) %}
G91
G1 E{E} F1900
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
[gcode_macro MAINTENANCE]
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
G1 X110 Y5 Z66.5 F600
M84
# Park toolhead
[gcode_macro M125]
gcode:
SAVE_GCODE_STATE NAME=parking
M117 Parking toolhead
G91
G1 Z5 F600 # move up 5 mm
G90
G1 X25 Y0 F4000 # move to park position
RESTORE_GCODE_STATE NAME=parking
# LOW_TEMP_CHECK checks if there is a setpoint for the extruder.
# - If this setpoint is reached, continue.
# - If not, heat to setpoint.
# - If no setpoint, heat to parameter T (default@200)
[gcode_macro LOW_TEMP_CHECK]
gcode:
{% set T = params.T|default(215) %}
{% if printer.extruder.target != 0 %} # if there is a setpoint for extruder
{% if printer.extruder.temperature < printer.extruder.target %} # if not reached, heat
M117 Heating from {printer.extruder.temperature} to {printer.extruder.target}.
M109 S{printer.extruder.target|float}
{% endif %}
{% else %} # if no setpoint for extruder
{% if printer.extruder.target < T %} # heat to T.
M117 No setpoint, heating to {T}.
M109 S{T}
{% endif %}
{% endif %}
# load filament alias
[gcode_macro M701]
gcode:
LOAD_FILAMENT
# load filament
[gcode_macro LOAD_FILAMENT]
gcode:
{% set E = params.E|default(400) %}
SAVE_GCODE_STATE NAME=loading_filament
M117 Loading Filament
G91 # set relative
G92 E0.0
LOW_TEMP_CHECK
G1 E15 F120 # pull filament slowly into extruder
G1 E{E} F1500 # length of bowden tube till cold-end (~420mm)
G1 E25 F120 # some extra to prime the nozzle --> slower
G92 E0.0
RESTORE_GCODE_STATE NAME=loading_filament
# unload filament alias
[gcode_macro M702]
gcode:
UNLOAD_FILAMENT
# unload filament
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set E = params.E|default(420) %}
SAVE_GCODE_STATE NAME=unloading_filament
M117 Unloading Filament
LOW_TEMP_CHECK
G91 # set relative
G1 E8 F100
G1 E2 F300
G1 E-10 F1800
G1 E-{E} F1500 # the E is the length of the bowden tube (420mm)
G92 E0.0
RESTORE_GCODE_STATE NAME=unloading_filament
# filament change
[gcode_macro M600]
gcode:
M117 Filament Change
SAVE_GCODE_STATE NAME=filament_change
BASE_PAUSE
LOW_TEMP_CHECK
G91 # relative
G1 E-1 F300 # retract 1
M125 # park
UNLOAD_FILAMENT # unload
M117 New filament
COUNTDOWN TIME=25 MSG="Switch"
LOAD_FILAMENT
COUNTDOWN TIME=10 MSG="Clean"
BASE_RESUME
M117 Resuming
RESTORE_GCODE_STATE NAME=filament_change
M117 Printing..
[gcode_macro COUNTDOWN]
gcode:
{% set MSG = params.MSG|default(Time)|string %}
{% set TIME = params.TIME|default(10) %}
# countdown
{% for s in range(TIME|int, 0, -1) %}
# dwell 1 second
G4 P1000
# echo
M117 {params.MSG} {s}sec
{% endfor %}