forked from viesturz/klipper-toolchanger
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
toolchanger-extra-macros.cfg
155 lines (139 loc) · 4.98 KB
/
toolchanger-extra-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
# OPTIONAL - Examples only
# Original written by Viesturs Zarins
[gcode_macro CLEAN_NOZZLE]
gcode:
;_TOOLCHANGER_CLEAN_NOZZLE
[gcode_macro TOOLCHANGE_DEMO]
description: [SAMPLES=<int>]
Run random tool changes.
SAMPLES= Number of changes to run, default is 20.
gcode:
{% set t = params.SAMPLES|default(20)|int %}
{% for n in range(t) %}
T{ printer.toolchanger.tool_numbers | random }
{% endfor %}
[gcode_macro G32]
gcode:
BED_MESH_CLEAR
QUAD_GANTRY_LEVEL
G28 Z
[gcode_macro PRINT_STATUS]
gcode:
{% set obj = params.OBJ %}
RESPOND TYPE=echo MSG="Status for M190 {obj} is { printer[obj] }"
[gcode_macro UNSAFE_LOWER_BED]
description: Lower the bed 100mm without homing
gcode:
G90
SET_KINEMATIC_POSITION Z=100
G0 Z0 F600
M84
[gcode_macro UNSAFE_RAISE_BED]
description: Raise the bed 100mm without homing
gcode:
G90
SET_KINEMATIC_POSITION Z=0
G0 Z100 F600
M84
[gcode_macro LOAD_FILAMENT]
gcode:
M117 Loading
M104 S240
G90 ; Absolute pos
G1 X100 Y00 Z90 F1800 ; Move to center
M104 S240 ;Heat up the filament
TEMPERATURE_WAIT SENSOR={printer.toolhead.extruder} MINIMUM=240
M83 ; set extruder to relative
G1 E50 F300 ; extrude 5 cm
G1 E50 F300 ; extrude 5 cm
G1 E-4 F1800 ; retract some
M82 ; set extruder to absolute
M400 ; wait for buffer to clear
M104 S0 ; Stop heating
M117 Loading done
[gcode_macro UNLOAD_FILAMENT]
gcode:
M117 Unloading
M104 S240 ;Heat up the filament
TEMPERATURE_WAIT SENSOR={printer.toolhead.extruder} MINIMUM=240
M83 ; set extruder to relative
G1 E5 F500 ; extrude 5 mm
G1 E-50 F1000 ; retract 5 cm
G1 E-50 F1000 ; retract 5 cm
M82 ; set extruder to absolute
M400 ; wait for buffer to clear
TURN_OFF_HEATERS
M117 Unloading done
[gcode_macro UNLOAD_ONE_FILAMENT]
gcode:
M117 Unloading {params.TOOL}
M109 T{params.TOOL} S240 ;Wait until heated
{% set start_extruder = printer.toolhead.extruder %}
{% set tool_name = printer.toolchanger.tool_names[params.TOOL|int] %}
{% set extruder = printer[tool_name].extruder %}
M104 T{params.TOOL} S240 ;Heat up the filament
TEMPERATURE_WAIT SENSOR={extruder} MINIMUM=240
ACTIVATE_EXTRUDER EXTRUDER={extruder}
M83 ; set extruder to relative
G1 E5 F500 ; extrude 5 mm
G1 E-50 F1000 ; retract 5 cm
G1 E-50 F1000 ; retract 5 cm
M82 ; set extruder to absolute
M400 ; wait for buffer to clear
TURN_OFF_HEATERS
ACTIVATE_EXTRUDER EXTRUDER={start_extruder}
M117 Unloading done
[gcode_macro UNLOAD_ALL_FILAMENT]
gcode:
{% set start_extruder = printer.toolhead.extruder %}
{% set tools = printer.toolchanger.tool_names %}
M117 Unloading
{% for tool in tools %}
M104 T{printer[tool].tool_number} S240 ;Heat up the filament
{% endfor %}
{% for tool in tools %}
M109 T{printer[tool].tool_number} S240 ;Wait until heated
ACTIVATE_EXTRUDER EXTRUDER={printer[tool].extruder}
M83 ; set extruder to relative
G1 E5 F500 ; extrude 5 mm
G1 E-50 F1000 ; retract 5 cm
G1 E-50 F1000 ; retract 5 cm
{% endfor %}
M400 ; Finish all th emoves
M82 ; set extruder to absolute
TURN_OFF_HEATERS
ACTIVATE_EXTRUDER EXTRUDER={start_extruder}
M117 Unloading done
[gcode_macro CHANGE_NOZZLE]
gcode:
M117 Nozzle change
M104 S240
G90 ; Absolute pos
G1 X175 Y0 Z100 F1800 ; Move to front
M109 S240 ;Heat up the filament
M83 ; set extruder to relative
G1 E5 F250 ; extrude 5 mm
G1 E-50 F1000 ; retract 5 cm
M82 ; set extruder to absolute
M117 Ready to swap
[gcode_macro M109]
rename_existing: M109.9999
description: [T<index>] [S<temperature>] [D<Deadband>]
Set tool temperature and wait.
T= Tool number [optional]. If this parameter is not provided, the current tool is used.
S= Target temperature
D= Dead-band, allows the temperature variance +/- the deadband
variable_default_deadband: 1.0
gcode:
{% set s = params.S|float %}
{% set deadband = default_deadband|float %}
{% if params.D is defined %}
{% set deadband = params.D|float %}
{% endif %}
{% set tn = params.T|default(printer.tool_probe_endstop.active_tool_number)|int %}
{% set tool = printer.toolchanger.tool_names[tn]|default('') %}
{% set extruder = printer[tool].extruder %}
SET_HEATER_TEMPERATURE HEATER={extruder} TARGET={s}
{% if s > 0 %}
TEMPERATURE_WAIT SENSOR={extruder} MINIMUM={s-(deadband/2)} MAXIMUM={s+(deadband/2)} ; Wait for hotend temp (within D degrees)
{% endif %}