-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
276 lines (223 loc) · 11.2 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
267
268
269
270
271
272
273
274
275
276
#################################
######### MACROS ###############
#################################
[gcode_macro START_PRINT]
gcode:
#Get Printer built volume dimensions
{% set X_MAX = printer.toolhead.axis_maximum.x|default(220)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(235)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(270)|float %}
#Get Nozzle diameter and filament width for conditioning
{% set NOZZLE = printer.extruder.nozzle_diameter|default(0.4)|float %}
{% set FILADIA = printer.extruder.filament_diameter|default(1.75)|float %}
# #Set Start coordinates of purge lines
# {% set X_START = 2.0|default(2.0)|float %}
# {% set Y_START = 10.0|default(10.0)|float %}
# #Calculate purge line extrusion volume and filament length
# {% set PRIMER_WIDTH = 1 * NOZZLE %}
# {% set PRIMER_HEIGHT = 0.5 * NOZZLE %}
# {% set PRIMER_SECT = PRIMER_WIDTH * PRIMER_HEIGHT %}
# {% set PRIMER_VOL = PRIMER_SECT * (Y_MAX - 3 - Y_START) * 2 %}
# {% set FILA_SECT = 3.1415 * ( FILADIA / 2.0) * ( FILADIA / 2.0) %}
# {% set FILA_LENGTH = 1.55 * PRIMER_VOL / FILA_SECT %}
#Get Bed and Extruder temperature from Slicer
{% set BED_TEMP = params.BED_TEMP|default(65)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(220)|float %}
{% set FILAMENT_TYPE = params.FILAMENT|default(PLA)|string %}
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
#{% set EXTRUDER_TEMP_PRE = 140|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(205)|float %}
#Preheat nozzle and bed
#M104 S{EXTRUDER_TEMP_PRE} T0
#M190 S{BED_TEMP}
#Home
G28
BED_MESH_CALIBRATE
#Park nozzle while things heat up
#G1 X{X_START} Y{Y_START-5} Z{PRIMER_HEIGHT} F6000.0
SMART_PARK
#Heat nozzle and bed
M190 S{BED_TEMP}
M109 S{EXTRUDER_TEMP} T0
#Purge line
G90
G92 E0
VORON_PURGE
# G1 X{X_START} Y{Y_START} Z{PRIMER_HEIGHT} F6000.0
# G1 X{X_START} Y{Y_MAX - 3 - Y_START} Z{PRIMER_HEIGHT} E{FILA_LENGTH} F2000.0
# G1 X{X_START + PRIMER_WIDTH} Y{Y_MAX - 3 - Y_START} Z{PRIMER_HEIGHT}
# G1 X{X_START + PRIMER_WIDTH} Y{Y_START} Z{PRIMER_HEIGHT} E{FILA_LENGTH*2} F2000.0
G92 E0
G1 Z2.0 F600
G1 Z0.2 F600
G1 Z2.0 F600
########################################################################################################################################
#########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$###########################################################################
[gcode_macro M109]
rename_existing: M99109
gcode:
#Parameters
{% set s = params.S|float %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1} ; Wait for hotend temp (within 1 degree)
{% endif %}
#####################################################################################################################################
#########################################################################################################################################
[gcode_macro END_PRINT]
# Use PRINT_END for the slicer ending script - please customize for your slicer of choice
gcode:
M400 ; wait for buffer to clear
#G92 E0 ; zero the extruder
G1 E-18.0 F3600 ; retract filament
G91 ; relative positioning
# Get Boundaries
{% set X_MIN = printer.toolhead.axis_minimum.x|default(0)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(235)|float %}
{% set max_z = printer.toolhead.axis_maximum.z|default(270)|float %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up and present print
G90
G0 X{X_MIN} Y{Y_MAX} F3600
TURN_OFF_HEATERS
M107 ; turn off fan
#G28 X Y
M84 ; Disable steppers
###################################################################################################
[gcode_macro LOAD_FILAMENT]
gcode:
M83 ; set extruder to relative
G1 E100 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 E5 F300 ; extrude a little to soften tip
G1 E-20 F1800 ; retract some, but not too much or it will jam
M82 ; set extruder to absolute
#######################################################################################################
#############################################################################################################
[gcode_macro M600]
gcode:
#LCDRGB R=0 G=1 B=0 ; Turn LCD green
PAUSE ; Pause
gcode: PAUSE X=10 Y=10 Z_MIN=50
##########################################################################################################
###################################################################################################
###########################################################################################################
###################################################################################################################
################################################################################################################
[gcode_macro SET_PRINT_STATS_INFO]
rename_existing: SET_PRINT_STATS_INFO_BASE
description: Overwrite, to get pause_next_layer and pause_at_layer feature
variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" }
variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" }
gcode:
{% if pause_next_layer.enable %}
{action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)}
{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_NEXT_LAYER ENABLE=0
{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
{action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))}
{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_AT_LAYER ENABLE=0
{% endif %}
SET_PRINT_STATS_INFO_BASE {rawparams}
#####################################################################################################
[gcode_macro _CLIENT_EXTRUDE]
description: Extrudes, if the extruder is hot enough
gcode:
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set use_fw_retract = False if not macro_found
else False if client.use_fw_retract is not defined
else True if client.use_fw_retract|lower == 'true' and printer.firmware_retraction is defined
else False %}
{% set length = (params.LENGTH|float) if params.LENGTH is defined
else 1.0 if not macro_found
else client.unretract|default(1.0) %}
{% set speed = params.SPEED if params.SPEED is defined
else 35 if not macro_found
else client.speed_unretract|default(35) %}
{% set absolute_extrude = printer.gcode_move.absolute_extrude %}
{% if printer.extruder.can_extrude %}
{% if use_fw_retract %}
{% if length < 0 %}
G10
{% else %}
G11
{% endif %}
{% else %}
M83
G1 E{length} F{(speed|float|abs) * 60}
{% if absolute_extrude %}
M82
{% endif %}
{% endif %}
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
###########################################################################################################
[gcode_macro _CLIENT_RETRACT]
description: Retracts, if the extruder is hot enough
gcode:
{% set macro_found = True if printer['gcode_macro _CLIENT_VARIABLE'] is defined else False %}
{% set client = printer['gcode_macro _CLIENT_VARIABLE'] %}
{% set length = (params.LENGTH|float) if params.LENGTH is defined
else 1.0 if not macro_found
else client.retract|default(1.0) %}
{% set speed = params.SPEED if params.SPEED is defined
else 35 if not macro_found
else client.speed_retract|default(35) %}
_CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs}
########################################################################################################
[gcode_macro RESPOND]
rename_existing: BASE_RESPOND
gcode:
{% set colors = ('primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning') %}
{% if params.PREFIX is defined %}
{% set prefix = 'PREFIX=' + params.PREFIX|string %}
{% endif %}
{% if params.TYPE is defined %}
{% if params.TYPE in ('echo', 'echo_no_space', 'command', 'error') and params.TYPE != '' %}
{% set type = 'TYPE=' + params.TYPE|string %}
{% else %}
BASE_RESPOND TYPE=error MSG="RESPOND TYPE '{params.TYPE}' is invalid. Must be one of 'echo', 'command' or 'error'"
{% endif %}
{% endif %}
{% if params.MSG is defined %}
{% set msg = 'MSG="'+ params.MSG + '"'|string %}
{% endif %}
{% if params.COLOR is defined %}
{% set color = params.COLOR|lower %}
{% if color in colors %}
{% set msg = 'MSG="<span class=' + color + '--text>' + params.MSG + '</span>"'|string %}
{% else %}
BASE_RESPOND TYPE=error MSG="RESPOND COLOR '{color}' is invalid. Must be one of 'primary', 'secondary', 'accent', 'info', 'success', 'warning' or 'error'"
{% endif %}
{% endif %}
BASE_RESPOND {prefix} {type} {msg}
########################################################################################################
### BTT KnOmI ###
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_BASE
variable_probing:False
gcode:
SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=True
BED_MESH_CALIBRATE_BASE
SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=False
[gcode_macro G28]
rename_existing: G0028
variable_homing:False
gcode:
SET_GCODE_VARIABLE MACRO=G28 VARIABLE=homing VALUE=True
G0028 {rawparams}
SET_GCODE_VARIABLE MACRO=G28 VARIABLE=homing VALUE=False
###########################################################################################
#####################################################################################################################################