-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
240 lines (205 loc) · 7.98 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
#####################################################################
# Macros
#####################################################################
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - PLEASE CUSTOMISE THE SCRIPT
gcode:
#M117 Homing... ; display message
#G28
#Z_TILT_ADJUST
#G28
#M117 ; display message
#G0 X150 Y150 Z30 F3600
#G92 E0 ; zero the extruder
#G1 E15.0 F3600 ; retract filament
{% set BED = params.BED|default(110)|int %}
{% set EXTRUDER = params.EXTRUDER|default(150)|int %}
STATUS_HEATING
M117 Heating bed...
M190 S{BED} ; set final bed temperature and wait for it to be reached
#M104 S{EXTRUDER*0.60} ; start preheating hotend to non-ooze temperature
M104 S150
STATUS_HOMING
M117 Homing...
G28
M109 S{EXTRUDER*0.80} ; heat nozzle for good wipe
STATUS_CLEANING
CLEAN_NOZZLE
STATUS_HOMING
#M109 S{EXTRUDER*0.60} ; cool nozzle to probe
G28 Z
M117 Bed Tilt...
STATUS_LEVELING
Z_TILT_ADJUST
STATUS_MESHING
M117 Calibrating mesh...
BED_MESH_CALIBRATE
STATUS_PRINTING
#Purge Line Gcode
G92 E0
G90
G0 X5 Y5 F6000
M117 Heating extruder...
M109 S{EXTRUDER} ; set final hotend temperature and wait for it
G1 E20.0 F3600 ; prime filament
PURGE
G1 Z10.0 F600 ; move the platform down 10mm
G92 E0 ; zero the extruded length again
G1 F9000
M117
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
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 + 2, th.axis_maximum.z]|min %}
STATUS_READY
SAVE_GCODE_STATE NAME=STATE_PRINT_END
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-20.0 F3600 ; 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
#G0 X{th.axis_minimum.x + 5} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at left rear
M107 ; turn off fan
M117
#STATUS_OFF
BED_MESH_CLEAR
RESTORE_GCODE_STATE NAME=STATE_PRINT_END
[gcode_macro PURGE]
description: Normal bed-front purge lines
gcode:
M117 Purging...
G0 Z0.4
G91
G1 X120 E30 F1200
G1 Y1
G1 X-120 E30 F1200
G1 Z2 E-.5 F3000 ; retract slightly to try and reduce stringing
G92 E0
G90
[gcode_macro LEDOFF]
gcode: SET_PIN PIN=caselight VALUE=0
[gcode_macro LEDON]
gcode: SET_PIN PIN=caselight VALUE=1
[bed_mesh]
speed: 400
horizontal_move_z: 5
##--------------------------------------------------------------------
## Uncomment below for 250mm build
#mesh_min: 40, 40
#mesh_max: 210,210
## Uncomment for 300mm build
#mesh_min: 40, 40
#mesh_max: 260,260
mesh_min: 25, 25
mesh_max: 275, 275
## Uncomment for 350mm build
#mesh_min: 40, 40
#mesh_max: 310,310
##--------------------------------------------------------------------
fade_start: 0.6
fade_end: 10.0
probe_count: 5,5
algorithm: bicubic
#relative_reference_index: 12
#zero_reference_position:
[gcode_macro PA_CAL]
# Pressure Advance Simple Test macro.
# Usage: PA_CAL BED=100 EXTRUDER=240 PA_START=0.03 PA_STEP=0.002 NZL=0.4
# Or with no parameters as: PA_CAL, this would execute as
# PA_CAL BED=99 EXTRUDER=239 PA_START=0.0 PA_STEP=0.005 NZL=(as per printer.cfg)
# First prints a line with current set PA, then prints 20 line segments
# starting with PA_START, increasing each line by PA_STEP.
# Based http://realdeuce.github.io/Voron/PA/pressure_advance.html
# Assisted by u/imoftendisgruntled, u/scul86, and thanks to u/beansisfat, u/stray_r
description: Tune Pressure Advance
gcode:
{% if printer.idle_timeout.state == "Printing" or printer.pause_resume.is_paused %}
{action_respond_info("Cannot do that while printing")}
{% else %}
{% set BED = params.BED|default(109)|float %}
{% set EXTRUDER = params.EXTRUDER|default(244)|float %}
{% set PA_START = params.PA_START|default(0.0)|float %}
{% set PA_STEP = params.PA_STEP|default(0.005)|float %}
{% set NZL_CFG = printer.configfile.config["extruder"]["nozzle_diameter"]|float %}
{% set NZL = params.NZL|default(NZL_CFG)|float %}
{% set E20 = (0.1147475 * NZL) * 20|float %}
{% set E40 = (0.1147475 * NZL) * 40|float %}
{% set X_MID = printer.configfile.config["stepper_x"]["position_max"]|float / 2.0 %}
{% set Y_MID = printer.configfile.config["stepper_y"]["position_max"]|float / 2.0 %}
PRINT_START BED={BED} EXTRUDER={EXTRUDER}
G21 ; Millimeter units
G90 ; Absolute XYZ
M83 ; Relative E
SET_VELOCITY_LIMIT ACCEL=3000 ACCEL_TO_DECEL=1500
G92 E0
M106 S0
G1 X{(X_MID-40)} Y{(Y_MID-65)} F30000 ; move to start position
G1 Z0.25 F300 ; move to layer height
G1 E0.75 F1800 ; un-retract
G1 X{(X_MID-20)} Y{(Y_MID-65)} E{E20} F300 ; print line part one
G1 X{(X_MID+20)} Y{(Y_MID-65)} E{E40} F9000 ; print line part two
G1 X{(X_MID+40)} Y{(Y_MID-65)} E{E20} F300 ; print line part three
G1 E-0.75 F1800 ; retract
G1 Z1 F300 ; Move above layer height
{% for i in range(0, 20) %}
SET_PRESSURE_ADVANCE ADVANCE={PA_START + (i * PA_STEP)} ; set Pressure Advance
M117 Testing Pressure Advance at: {PA_START + (i * PA_STEP)}
G1 X{(X_MID-40)} Y{(Y_MID-35)+(5*i)} F30000 ; move to start position
G1 Z0.25 F300 ; move to layer height
G1 E0.75 F1800 ; un-retract
G1 X{(X_MID-20)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part one
G1 X{(X_MID+20)} Y{(Y_MID-35)+(5*i)} E{E40} F9000 ; print line part two
G1 X{(X_MID+40)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part three
G1 E-0.75 F1800 ; retract
G1 Z1 F300 ; Move above layer height
{% endfor %}
M117 Find best line and multiply it by ({PA_START} + (line * {PA_STEP}) ) to find your PA setting.
PRINT_END
{% endif %}
##### Enable object exclusion #####
[exclude_object]
##### Git Backup #####
[gcode_macro GIT_BACKUP]
gcode:
RUN_SHELL_COMMAND CMD=backup_cfg
[gcode_shell_command backup_cfg]
command: sh /home/pi/klipper_config/.autocommit.sh
timeout: 30.
verbose: True
# ##### Resonance Testing Functions #####
[gcode_shell_command generate_graphs]
command: sh /home/pi/klipper_config/.generate_graphs.sh
timeout: 320.
verbose: True
[gcode_macro GENERATE_GRAPHS]
gcode:
RUN_SHELL_COMMAND CMD=generate_graphs
[gcode_shell_command graph_resonance]
command: sh /home/pi/klipper_config/.graph_resonance.sh
timeout: 320.
# verbose: True
[gcode_macro GRAPH_RESONANCE]
gcode:
RUN_SHELL_COMMAND CMD=graph_resonance
[gcode_macro TEST_X]
gcode:
TEST_RESONANCES AXIS=X
[gcode_macro TEST_Y]
gcode:
TEST_RESONANCES AXIS=Y
[gcode_macro MEASURE_SENSOR_NOISE]
gcode:
MEASURE_AXES_NOISE
[gcode_macro QUERY_ACCELEROMETER]
gcode:
ACCELEROMETER_QUERY
[gcode_macro MEASURE_RESONANCE]
gcode:
TEST_RESONANCES AXIS=1,1 OUTPUT=raw_data
TEST_RESONANCES AXIS=1,-1 OUTPUT=raw_data