forked from zellneralex/klipper_config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filament.cfg
176 lines (170 loc) · 9.07 KB
/
filament.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
[firmware_retraction]
retract_length: 0.75 ; length of filament (in mm) at G10/G11
unretract_extra_length: 0 ; length of additional filament (in mm) at G11
retract_speed: 50
unretract_speed: 30
#####################################################################
# Macro
#####################################################################
[gcode_macro _FILAMENT_BALL]
description: Helper: Round the filament tip
gcode:
G92 E0 ; zero the extruder
M83 ; relative extrusion
G1 E2 F{printer['gcode_macro _USER_VARIABLE'].speed.retract * 2}
G1 E-2
G1 E4
G1 E-4
G1 E8
G1 E-8
G1 E-25
G4 P{params.WAIT|default(0)|int * 1000}
[gcode_macro FILAMENT_LOAD]
description: Load filament and disable rounout while running
gcode:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% set pos = printer['gcode_macro _USER_VARIABLE'].purge.purge %}
{% set move_z = [user.z_hop,printer.toolhead.position.z]|max %} ; calc movement high
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
{% if user.hw.runout.type == 'motion' %} SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0 {% endif %}
_CG28 ; home if not already homed
G90 ; absolute positioning
G1 Z{move_z} F{user.speed.z_hop} ; move head to minimum
G1 X{pos.x} Y{pos.y} F{user.speed.travel} ; move to purge bucket location
{% if user.hw.display.ena %} _LCD_KNOB COLOR=BLUE {% endif %}
{% if not printer.extruder.can_extrude %}
{action_respond_info("Extruder Temp to low heat to %3.1f°C" % printer.configfile.settings.extruder.min_extrude_temp)}
M109 S{printer.configfile.settings.extruder.min_extrude_temp}
{% endif %}
{% if user.hw.display.ena %} _LCD_KNOB {% endif %}
G1 Z{pos.z} F{user.speed.z_hop}
M83 ; set extruder to relative
G1 E{user.filament.load_distance} F{user.speed.load} ; quickly load filament
{% if user.hw.runout.typet == 'motion' %}
_PRINT_AR T="RUNOUT Motion Sensor Enable: true"
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=1
{% endif %}
G1 E{user.filament.load_extrude} F{user.speed.retract} ; slower load filament
G1 E-{user.filament.retract.pause}
_WIPE ; clean nozzle
G1 Z{move_z} F{user.speed.z_hop}
G1 X{pos.x} Y{pos.y} F{user.speed.travel} ; move to purge bucket location
M109 S{printer.extruder.target} ; restore old extruder temperature
_PRINT_AR T="Filament loaded"
SAVE_VARIABLE VARIABLE=filament_loaded VALUE=True
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} ; set it back to relativ
{% if printer.gcode_move.absolute_extrude %} M82 {% endif %} ; set it back to absolute
{% else %}
_PRINT_AR T="Filament loading disabled while printing!"
{% endif %}
[gcode_macro FILAMENT_UNLOAD]
description: Unload filament and disable rounout while running
gcode:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% if printer.idle_timeout.state != "Printing" or printer.pause_resume.is_paused|lower == "true" %}
{% if user.hw.runout.type == 'motion' %}
_PRINT_AR T="RUNOUT Motion Sensor Enable: false"
SET_FILAMENT_SENSOR SENSOR=runout ENABLE=0
{% endif %}
{% if user.hw.display.ena %} _LCD_KNOB COLOR=BLUE {% endif %}
{% if not printer.extruder.can_extrude %}
{action_respond_info("Extruder Temp to low heat to %3.1f°C" % printer.configfile.settings.extruder.min_extrude_temp)}
M109 S{printer.configfile.settings.extruder.min_extrude_temp}
{% endif %}
{% if user.hw.display.ena %} _LCD_KNOB {% endif %}
_FILAMENT_BALL WAIT=3 ; ball up the filament tip and retract out past the extruder gears
G1 E-{user.filament.unload_distance} F{user.speed.load}
M109 S{printer.extruder.target} ; restore old extruder temperature
_PRINT_AR T="Filament unloaded"
SAVE_VARIABLE VARIABLE=filament_loaded VALUE=False
{% if printer.gcode_move.absolute_extrude %} M82 {% endif %} ; set it back to absolute
{% else %}
_PRINT_AR T="Filament unloading disabled while printing!"
{% endif %}
[gcode_macro NOZZLECLEAN]
description: Move to bucket and purge and scrub nozzle
gcode:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% set pos = user.purge.purge %}
{% set move_z = [user.z_hop,printer.toolhead.position.z]|max %} ; calc movement high
SET_GCODE_OFFSET Z=0.0
_PRINT_AR T="Clean Nozzle" SHOW_LCD=true
_CG28 ; home if not already homed
G90 ; absolute positioning
G1 Z{move_z} F{user.speed.z_hop} ; move head up
G1 X{pos.x} Y{pos.y} F{user.speed.travel} ; move to purge bucket location
G1 Z{pos.z} F{user.speed.z_hop} ; lower Z
{% if not printer.extruder.can_extrude %}
{action_respond_info("Extruder Temp to low heat to %3.1f°C" % printer.configfile.settings.extruder.min_extrude_temp)}
M109 S{printer.configfile.settings.extruder.min_extrude_temp}
{% endif %}
G92 E0 ; reset Extruder
M83 ; relative extrusion
G1 E2 F500 ; purge filament
G1 E2 F800 ; purge filament
G1 E-1 F800 ; retract filament
G4 P500
_WIPE
M109 S{printer.extruder.target} ; restore old extruder temperature
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=1
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} ; set it back to relative
{% if printer.gcode_move.absolute_extrude %} M82 {% endif %} ; set it back to absolute
SET_GCODE_OFFSET Z={printer.gcode_move.homing_origin.z} MOVE=1
[gcode_macro _WIPE]
description: Helper: Wipe nozzle at bucket
gcode:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% set wipe = user.purge.wipe %}
G90 ; absolute positioning
G0 X{wipe.start.x} Y{wipe.start.y} Z{wipe.start.z} F{user.speed.wipe}
{% for moves in range(0, wipe.cnt) %} ; move head diagonal to brush
{% for coordinate in [wipe.start.x, wipe.end.x] %}
G0 X{coordinate} Y{wipe.start.y + wipe.offset * moves}
{% endfor %}
{% endfor %}
G0 X{wipe.end.x} Y{wipe.end.y} Z{wipe.end.z}
[gcode_macro PRIME_LINE]
description: Purge nozzle at defined position
gcode:
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% set prime = user.prime %}
{% set prime_height = params.PRIME_HEIGHT|default(prime.pos.z) %} ; get parameter or set default
{% set move_z = [user.z_hop,printer.toolhead.position.z]|max %} ; calc movement high
{% if prime.dir|string == 'X+' %}
{% set first_line = 'X%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set second_line = 'X-%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set move_to_side = 'Y%s' % prime.spacing %}
{% elif prime.dir|string == 'X-' %}
{% set first_line = 'X-%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set second_line = 'X%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set move_to_side = 'Y%s' % prime.spacing %}
{% elif prime.dir|string == 'Y+' %}
{% set first_line = 'Y%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set second_line = 'Y-%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set move_to_side = 'X%s' % prime.spacing %}
{% elif prime.dir|string == 'Y-' %}
{% set first_line = 'Y-%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set second_line = 'Y%s E%s F%s' % (prime.length_per_seg, prime.extrude_per_seg, user.speed.prime) %}
{% set move_to_side = 'X%s' % prime.spacing %}
{% else %}
{action_raise_error("_USER_VARIABLE.prime.dir is not spezified as X+, X-, Y+ or Y-")}
{% endif %}
_PRINT_AR T="Prime Line" SHOW_LCD=true
_CG28 ; home if not already homed
G92 E0 ; reset Extruder
G90 ; absolute positioning
G1 Z{move_z} F{user.speed.z_hop} ; move head up
G1 X{prime.pos.x} Y{prime.pos.y} F{user.speed.travel} ; move to start position
G1 Z{prime_height} F{user.speed.z_hop} ; move Z Axis down
G91 ; relative positioning
{% for segment in range(prime.seg|int) %} ; draw the first line
G1 {first_line}
{% endfor %}
G1 {move_to_side} ; move to side
{% for segment in range(prime.seg|int) %} ; draw the second line
G1 {second_line}
{% endfor %}
G92 E0 ; reset Extruder
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} ; set it back to relative
{% if printer.gcode_move.absolute_extrude %} M82 {% endif %} ; set it back to absolute
UPDATE_DELAYED_GCODE ID=_CLEAR_DISPLAY DURATION=1