-
Notifications
You must be signed in to change notification settings - Fork 51
/
macros.cfg
218 lines (200 loc) · 5.55 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
# WARNING. DO NOT EDIT THIS FILE.
# To override settings from this file, you can copy and paste the relevant
# sections into your printer.cfg and change it there.
[gcode_macro M486]
gcode:
CLEAR_PAUSE
[gcode_macro G80]
gcode:
M117 Bed leveling
BED_MESH_CALIBRATE
G1 X0 Y0 Z0.4 F4000
M117
M400
[gcode_macro G81]
gcode:
BED_MESH_OUTPUT
[gcode_macro M300]
gcode:
# Use a default 1kHz tone if S is omitted.
{% set S = params.S|default(1000)|int %}
# Use a 10ms duration is P is omitted.
{% set P = params.P|default(100)|int %}
SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
G4 P{P}
SET_PIN PIN=BEEPER_pin VALUE=0
[gcode_macro UNLOAD_FILAMENT]
gcode:
SAVE_GCODE_STATE NAME=unload_state
G91
{% if params.TEMP is defined or printer.extruder.can_extrude|lower == 'false' %}
M117 Heating...
# Heat up hotend to provided temp or 220 as default as that should work OK with most filaments.
M109 S{params.TEMP|default(220, true)}
{% endif %}
M117 Unloading filament...
G92 E0.0
G91
G1 E-45 F5000
G1 E-15 F1000
G1 E-20 F1000
G90
G92 E0.0
M400
M117 Remove Filament Now!
M300 S300 P1000
M117 Filament unloaded!
RESTORE_GCODE_STATE NAME=unload_state
[gcode_macro LOAD_FILAMENT]
gcode:
SAVE_GCODE_STATE NAME=load_state
G91
# Heat up hotend to provided temp or 220 as default as that should work OK with most filaments.
{% if params.TEMP is defined or printer.extruder.can_extrude|lower == 'false' %}
M117 Heating...
M109 S{params.TEMP|default(220, true)}
{% endif %}
M117 Loading filament...
# Load the filament into the hotend area.
G92 E0.0
G91
G1 E70 F400
G1 E40 F100
G90
G92 E0.0
M400
M117 Filament loaded!
RESTORE_GCODE_STATE NAME=load_state
[delayed_gcode clear_display]
initial_duration: 0.
gcode:
M117
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
SDCARD_RESET_FILE
# Raise nozzle by 60mm
G1 Z60 F3000
G90
# Disable steppers
M84
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
CLEAR_PAUSE
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set z_park_delta = 2.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 - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E-{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
# Prusa's calibrate Z
[gcode_macro Calibrate_Z]
description: Calibrate Z axis
gcode:
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
G1 X20 Y0
G1 Z{max_z-10} F2000 #Update with Z height.
FORCE_MOVE STEPPER=stepper_z Distance=20 Velocity=10
G1 Z{max_z-50} F2000 # Move down
G28 # Home again
[gcode_macro PREHEAT_PLA]
gcode:
# Start bed heating
M140 S60
# Start nozzle heating
M104 S200
[gcode_macro PREHEAT_PETG]
gcode:
# Start bed heating
M140 S90
# Start nozzle heating
M104 S240
[gcode_macro PREHEAT_TPU]
gcode:
# Start bed heating
M140 S50
# Start nozzle heating
M104 S190
# Color Change
[gcode_macro M600]
description: Color change
gcode:
{% set X = params.X|default(0)|float %}
{% set Y = params.Y|default(0)|float %}
{% set Z = params.Z|default(10)|float %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000
G91
G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state