forked from nehilo/Klipper-KingRoon-Printers
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmacros.cfg
266 lines (247 loc) · 9.52 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
#[gcode_macro M300]
#gcode: SET_PIN PIN=_BEEPER_pin VALUE={S}
# G4 P{P}
# SET_PIN PIN=_BEEPER_pin VALUE=0
[gcode_macro PARK]
gcode:
PAUSE
[gcode_macro M600]
description: Filament change macro
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
M118 Homing
G28
{% endif %}
{% if printer.extruder.can_extrude == 0 %}
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z > (max_z - 20.0) %}
{% set z_safe = max_z %}
{% else %}
{% set z_safe = (act_z + 20.0) %}
{% endif %}
G91
G1 Z{z_safe}
G90
G1 X0 Y0 F2100
M118 Acquiring temperature
M109 S200
{% endif %}
{% if printer.pause_resume.is_paused == 0 %}
PAUSE
{% endif %}
M118 First UNLOAD, then LOAD new and RESUME when ready
[gcode_macro FILAMENT_UNLOAD]
description: Unload filament helper
gcode:
# {% if printer.pause_resume.is_paused == 1 %}
{% if printer.extruder.can_extrude == 1 %}
G91
G1 E5 F500 # Move a bit forward to heat up tip
G1 E-80 F2000 # Quickly unload filament to reduce chance of clocking
G90
{% else %}
RESPOND TYPE=error MSG="Extrude below minimum temp"
{% endif %}
# {% else %}
# RESPOND TYPE=error MSG="Printer must be paused"
# {% endif %}
[gcode_macro FILAMENT_LOAD]
description: Load filament helper
gcode:
# {% if printer.pause_resume.is_paused == 1 %}
{% if printer.extruder.can_extrude == 1 %}
G91
G1 E80 F500 # Extrude filament
G90
{% else %}
RESPOND TYPE=error MSG="Extrude below minimum temp"
{% endif %}
# {% else %}
# RESPOND TYPE=error MSG="Printer must be paused"
# {% endif %}
[gcode_macro LOW_TEMP_CHECK_T]
gcode:
{% if printer.extruder.target != 0 %} # if there is a setpoint for extruder
{% if printer.extruder.temperature < printer.extruder.target %} # if not reached, heat
# M118 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.
# M118 No setpoint, heating to {T}.
M109 S{T}
{% endif %}
{% endif %}
[gcode_macro M900]
description: Set pressure advance
gcode:
SET_PRESSURE_ADVANCE ADVANCE={params.K|default(0)}
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
##### set defaults #####
{% set x = params.X|default(10) %} # edit to your park position
{% set y = params.Y|default(170) %} # edit to your park position
{% set z = params.Z|default(20)|float %} # edit to your park position
{% set e = params.E|default(1) %} # edit to your retract length
##### calculate safe 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 #####
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{e} F300
G1 Z{z_safe}
G90
G1 X{x} Y{y} F4000
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
##### set defaults #####
{% set e = params.E|default(1) %} # edit to your retract length
G91
G1 E{e} F300
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
{% set ENDY = printer.toolhead.axis_maximum.y|float - 10 %}
G91
G1 E-1 F300
G1 Z1 E-1 F4000
G90
G1 X0 Y{ENDY}
M84
M106 S0
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
[gcode_macro XY_SKEW]
gcode:
SET_SKEW XY=140.5,140.65,99.6
[gcode_macro PRIME_NOZZLE]
gcode:
G1 X3.1 Y1.0 Z0.28 F5000.0 # Move to start position
G92 E0 # zero the extruded length
G1 F200 E3 # extrude 3mm of feed stock
G92 E0 # zero the extruded length again
G1 X150 Y1.0 Z0.28 F1500.0 E10 # Draw the first line
G1 X150 Y1.3 Z0.28 F5000.0 # Move to side a little
G1 X3.1 Y1.3 Z0.28 F1500.0 E20 # raw the second line
G92 E0 # Reset Extruder
G1 F2700 E-2 # Retract a bit
G92 E0 # Reset Extruder
[gcode_macro START_PRINT]
gcode:
G21 # metric values
G90 # absolute positioning
M82 # set extruder to absolute mode
M107 # start with the fan off
M140 S{params.BEDTEMP|default(50)} # (bed preheat)
G28 # (Home the printer)
M109 S{params.EXTRUDERTEMP|default(180)} # (wait for extruder preheat)
G92 E0 # (Reset the extruder to 0)
G0 Z5 E15 F500 # (Move up and prime the nozzle)
PRIME_NOZZLE # execute priming macro
#XY_SKEW
[gcode_macro END_PRINT]
gcode:
G0 X0 Y120 # (Stick out the part)
M190 S0 # (Turn off heat bed, don't wait.)
G92 E10 # (Set extruder to 10)
G1 E-3 F200 # (retract 3mm)
M104 S0 # (Turn off nozzle, don't wait)
G4 S10 # (Delay 10 seconds)
M107 # (Turn off part fan)
M84 # (Turn off stepper motors.)
[gcode_macro Bed_Mesh]
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28 # home if not homed
{% endif %}
SAVE_GCODE_STATE NAME=G29_STATE
{% if params.T|int > 30 %}
M140 S{params.T} # set bed temperature
M190 S{params.T} # wait for bed temperature
{% endif %}
BED_MESH_CALIBRATE
G0 X10 Y10 F6000
[gcode_macro PROBE_CALIBRATE]
rename_existing: BASE_PROBE_CALIBRATE
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28 # home if not homed
{% endif %}
BASE_PROBE_CALIBRATE
[gcode_macro PRIME_LINE]
# PrusaSliser: PRIME_LINE F={first_layer_speed}
# Cura: PRIME_LINE F={speed_print_layer_0}
gcode:
{% set feedrate = params.F|default(20)|float * 60 %}
{% set length = params.L|default(120)|float %}
{% if 'Y' in params %}
{% set length_max = ( printer.toolhead.axis_maximum.y|float - 10.0 ) %}
{% else %}
{% set length_max = ( printer.toolhead.axis_maximum.x|float - 10.0 ) %}
{% endif %}
{% if length > length_max %}
{% set length = length_max %}
{% endif %}
{% set width = printer.configfile.settings.extruder.nozzle_diameter|float %}
{% set height = ( (width / 0.04)|int - (width / 0.04 / 4)|int )|float * 0.04 %}
{% set extrude = 1.5 * length * width * height / 2.4 %}
SAVE_GCODE_STATE NAME=PRIME_LINE_STATE
SET_IDLE_TIMEOUT TIMEOUT=7200
{% if 'Y' in params %}
{% set x_start = 5.0 %}
{% set y_start = (printer.toolhead.axis_maximum.y|float - length) / 2 %}
G0 X{x_start} Y{y_start} Z{height} F5000 # move to start position
G91 # relative positioning
G1 Y{length} E{extrude} F{feedrate} # draw the 1st line
G1 X{width} F5000 # move to the next line
G1 Y-{length} E{extrude} F{feedrate} # draw the 2nd line
{% else %}
{% set x_start = (printer.toolhead.axis_maximum.x|float - length) / 2 %}
{% set y_start = 5.0 %}
G0 X{x_start} Y{y_start} Z{height} F5000 # move to start position
G91 # relative positioning
G1 X{length} E{extrude} F{feedrate} # draw the 1st line
G1 Y{width} F5000 # move to the next line
G1 X-{length} E{extrude} F{feedrate} # draw the 2nd line
{% endif %}
RESTORE_GCODE_STATE NAME=PRIME_LINE_STATE
[gcode_macro _FILAMENT_BALL]
description: Helper: Round the filament tip
gcode:
##### set default parameter value #####
{% set wait = params.WAIT|default(0) %}
##### end of definitions #####
SAVE_GCODE_STATE NAME=STATE_FILAMENT_BALL
# Ball up the filament tip
G92 E0 # zero the extruder
M82 # absolute extrusion
G1 E2 F3600
G1 E0 F3600
G1 E4 F3600
G1 E0 F3600
G1 E8 F3600
G1 E0 F3600
M83 # relative extrusion
G1 E-25 F3600
G4 P{wait|int * 1000}
RESTORE_GCODE_STATE NAME=STATE_FILAMENT_BALL
[gcode_macro TUNING_PA]
gcode:
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=1 ACCEL=500
TUNING_TOWER COMMAND=SET_PRESSURE_ADVANCE PARAMETER=ADVANCE START=0 FACTOR={params.FACTOR|default(0.005)}