-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacros.cfg
230 lines (199 loc) · 7.54 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
# Convert Marlin linear advance (M900) commands to Klipper (SET_PRESSURE_ADVANCE) commands.
# For use with Marlin's linear advance calibration: https://marlinfw.org/tools/lin_advance/k-factor.html
[gcode_macro M900]
gcode:
# Parameters
{% set pa = params.K|float %}
SET_PRESSURE_ADVANCE ADVANCE={pa}
[gcode_macro _CHECK_HOMED]
gcode:
{% if "xyz" not in printer.toolhead.homed_axes %}
G28
{% endif %}
[gcode_macro COME_OVER_HERE]
gcode:
_CHECK_HOMED
G90
G0 X60 Y30 Z40 F3600
[gcode_macro MOTORS_OFF]
gcode:
M84
[gcode_macro PAUSE]
rename_existing: PAUSE_BASE
gcode:
{% set X = params.X|default(120)|int %}
{% set Y = params.Y|default(120)|int %}
{% set Z = params.Z|default(10)|int %}
{% set E = params.E|default(1)|int %}
SAVE_GCODE_STATE NAME=PAUSE_state
PAUSE_BASE
G91
G1 E-{E} F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
LED_STATUS_ORANGE
[gcode_macro RESUME]
rename_existing: RESUME_BASE
gcode:
{% set E = params.E|default(1)|int %}
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
RESUME_BASE
LED_STATUS_WHITE
[gcode_macro TURN_OFF_FANS]
gcode:
M107 ; turn off fan
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
LED_STATUS_RED
TURN_OFF_HEATERS
TURN_OFF_FANS
CLEAR_PAUSE
SDCARD_RESET_FILE
M220 S100 ; Reset feed rate to 100%
M221 S100 ; Reset extrusion rate to 100%
SET_PRESSURE_ADVANCE ADVANCE=0 ; Disable Pressure Advance
BASE_CANCEL_PRINT
UPDATE_DELAYED_GCODE ID=DISABLE_NEVERMORE DURATION=240
##########################
##########################
[gcode_macro PURGE_LINE]
gcode:
G90 ; Use absolute coordinates
G1 X0.0 Y0.5 Z0.1 F3600 ; Move to front
G91 ; relative positioning
G1 E2 F3600 ; un-retract filament
G90 ; Use absolute coordinates
G1 X30.0 Y0.5 Z0.2 E1.5 F2800 ; move to position for purge line
G1 X60.0 E3.0 F1000 ; start purge line
G1 X90.0 E7.0 F1000 ; finish purge line
G1 Z1.5 F3600
G92 E0
G1 X93.0 Z0.1 E-0.3 F2800
G1 X100.0 Y0.5 Z5.0 F3600 ; move nozzle away from bed
[gcode_macro PRINT_START]
# Use PRINT_START for the slicer starting script - please customise for your slicer of choice
gcode:
{% set BED_TEMP = params.BED_TEMP|default(100)|int %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(230)|int %}
UPDATE_DELAYED_GCODE ID=DISABLE_NEVERMORE DURATION=0
LED_STATUS_WHITE ; Turn on lights
M140 S{BED_TEMP} ; Start bed heating
#M104 S{EXTRUDER_TEMP} ; Start nozzle Heating
G90 ; Use absolute coordinates
SET_GCODE_OFFSET Z=0.0 ; Reset the G-Code Z offset (adjust Z offset if needed)
G28 ; Home the printer
G1 Z20 F3000 ; Move the nozzle near the bed
G1 Z5 F300 ; Move the nozzle very close to the bed
M190 S{BED_TEMP} ; Wait for bed to reach temperature
M109 S{EXTRUDER_TEMP} ; Wait for nozzle to reach temperature
G28 ; Home the printer
G0 Z0 F6000
SET_FAN_SPEED FAN=nevermore SPEED=1 ; Enable Air-filter
PURGE_LINE ; Purge the Nozzle
[gcode_macro PRINT_END]
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-1 F3600 ; retract filament
G91 ; relative positioning
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% 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
G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing
G90 ; absolute positioning
G0 X60 Y{max_y} F3600 ; park nozzle at rear
TURN_OFF_HEATERS
M107 ; turn off fan
M220 S100 ; Reset feed rate to 100%
M221 S100 ; Reset extrusion rate to 100%
SET_PRESSURE_ADVANCE ADVANCE=0 ; Disable Pressure Advance
LED_STATUS_GREEN
UPDATE_DELAYED_GCODE ID=DISABLE_NEVERMORE DURATION=240
[gcode_macro LOAD_FILAMENT]
gcode:
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(260)|int %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={EXTRUDER_TEMP}
; COME_OVER_HERE
M109 S{EXTRUDER_TEMP}
M83 ; set extruder to relative
G1 E310 F1800 ; quickly load filament to down bowden
G1 E30 F300 ; slower extrusion for hotend path
G1 E15 F150 ; prime nozzle with filament
M82 ; set extruder to absolute
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(260)|int %}
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={EXTRUDER_TEMP}
COME_OVER_HERE
M109 S{EXTRUDER_TEMP}
M83 ; set extruder to relative
G1 E10 F300 ; extrude a little to soften tip
G1 E-380 F1800 ; retract filament completely
M82 ; set extruder to absolute
[delayed_gcode DISABLE_NEVERMORE]
initial_duration: 0.0
gcode:
SET_FAN_SPEED FAN=nevermore SPEED=0
[gcode_macro M600]
gcode:
{% set X = params.X|default(50)|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
UNLOAD_FILAMENT
RESTORE_GCODE_STATE NAME=M600_state
## - DUMP_WARNINGS
#[gcode_macro DUMP_WARNINGS]
#description: Debug: Print all warning messages from klipper
#gcode:
# {% set parameters = ["printer.configfile.warnings:"] %}
# {% for warning in printer.configfile.warnings %}
# {% set parameters = parameters.append("%s -> %s -> %s\n%s" % (warning.type, warning.section, warning.option, warning.message)) %}
# {% endfor %}
# {action_respond_info(parameters|join("\n"))}
#[gcode_macro SELECT_PA]
#default_parameter_NOZZLE: 0.4
#default_parameter_FILAMENT: None
#
#variable_pa_PETGExtrudrWhite0.8: 0.035
#variable_pa_PETGExtrudrWhite0.6: 0.0535
#variable_pa_ABSPEsunBlack0.6: 0.0535
#
#gcode:
# {% set pavar = ('pa_' + FILAMENT + NOZZLE)|lower %}
# {% if pavar in printer["gcode_macro SELECT_PA"] %}
# SET_PRESSURE_ADVANCE ADVANCE={printer["gcode_macro SELECT_PA"][pavar]}
# {% else %}
# SET_PRESSURE_ADVANCE ADVANCE=0
# {% endif %}