-
Notifications
You must be signed in to change notification settings - Fork 2
/
dual_extruder.cfg
160 lines (151 loc) · 6.21 KB
/
dual_extruder.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
# Driver5
# [extruder1]
# step_pin: PC13
# dir_pin: !PF0
# enable_pin: !PF1
# microsteps: 16
# full_steps_per_rotation: 200
# rotation_distance: 8.512 #7.402
# #step_distance: .0025
# nozzle_diameter: 0.400
# filament_diameter: 1.750
# max_extrude_only_distance: 800.0
# shared_heater: extruder
# #heater_pin: PA3 # HE1
# #sensor_pin: PF5 # T1
# #extruder: extruder1
# #pause_on_runout: True
# [filament_motion_sensor fsensor0] # material_0
# #AK#switch_pin: PG12
# switch_pin: PG11
# detection_length: 7.0
# extruder: extruder
# pause_on_runout: True
[extruder_stepper extruder1] ## In E2-MOT Position
#extruder: # If blank, not synchronized
#step_pin: PE2
#dir_pin: !PE4
#enable_pin: !PE3
#rotation_distance: 16.2195549266491 # Geeetech Motor
#microsteps: 16
extruder: # If blank, not synchronized
step_pin: PC13
dir_pin: !PF0
enable_pin: !PF1
microsteps: 16
# full_steps_per_rotation: 200
rotation_distance: 8.512 #7.402
[gcode_macro T0]
gcode:
{% set LOAD = params.LOAD|default(1)|int %} # Value of 1 will Unload other extruders and load this one
M117 Macro T0 LOAD:{LOAD}
{ action_respond_info("T0 %s" % (LOAD)) }
{% if (LOAD == 1) %} # SWAP
M117 Macro T0 - Load==1
SWAP_EXTRUDER ID=0
{% else %} # Aktivate
M117 Macro T0 - else
ACTIVATE_EXT ID=0
{% endif %}
[gcode_macro T1]
gcode:
{% set LOAD = params.LOAD|default(1)|int %} # Value of 1 will Unload other extruders and load this one
M117 Macro T1 LOAD:{LOAD}
{ action_respond_info("T1 %s" % (LOAD)) }
{% if (LOAD == 1) %} # SWAP
SWAP_EXTRUDER ID=1
{% else %} # Aktivate
ACTIVATE_EXT ID=1
{% endif %}
[gcode_macro ACTIVATE_EXT]
description: ACTIVATE_EXT(ID)
gcode:
{% set ID = params.ID|default(0)|int %} # Extruder ID :: 0=extruder , 1=extruder1
M117 Macro ACTIVATE_EXT ID:{ID}
{% if (ID == 0) %}
SYNC_EXTRUDER_MOTION EXTRUDER=extruder1 MOTION_QUEUE= # Remove other extruders from motion queue
SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE=extruder # Add e1 to the motion queue
{% elif (ID == 1) %}
SYNC_EXTRUDER_MOTION EXTRUDER=extruder MOTION_QUEUE= # Remove other extruders from motion queue
SYNC_EXTRUDER_MOTION EXTRUDER=extruder1 MOTION_QUEUE=extruder # Add e1 to the motion queue
{% endif %}
[gcode_macro SWAP_EXTRUDER]
description: SWAP_EXTRUDER(ID)
gcode:
{% set ID = params.ID|default(0)|int %}
M117 Macro SWAP_EXTRUDER ID:{ID}
SAVE_GCODE_STATE NAME=swap_state
{% if (printer.save_variables.variables.load_extruder != ID) %}
EXTRUDER_UNLOAD ID={printer.save_variables.variables.load_extruder}
EXTRUDER_LOAD ID={ID}
{% else %}
ACTIVATE_EXT ID={ID}
{% endif %}
RESTORE_GCODE_STATE NAME=swap_state
[gcode_macro EXTRUDER_LOAD]
description: EXTRUDER_LOAD(ID)
gcode:
{% set ID = params.ID|default(0)|int %} # Extruder ID :: 0=extruder , 1=extruder1
M117 Macro EXTRUDER_LOAD ID:{ID}
ACTIVATE_EXT ID={ID}
{% if (printer.save_variables.variables.load_extruder != ID) %}
M117 Macro EXTRUDER_LOAD ID:{ID} loading...
SAVE_GCODE_STATE NAME=load_state
M117 LOAD_EXTR UNLOAD_DISTANCE={((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)}
G92 E0
M83
# Using this variable makes sure load and unload move the same amount
# last 50mm going in are slowed down (reason they are subtracted)
# Change unload position amount in variables_user.cfg
{% for i in range(((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)/100)|int) %}
G1 E100 F3000
RESPOND MSG={(((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)/100)|int)}
{% endfor %}
G1 E{(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)%100} F5000
RESPOND MSG={(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)-50)%100}
G1 E30 F1000
G1 E20 F300
RESPOND MSG="50"
M82
RESTORE_GCODE_STATE NAME=load_state
SAVE_VARIABLE VARIABLE=load_extruder VALUE={ID}
{% endif %}
[gcode_macro EXTRUDER_UNLOAD]
description: EXTRUDER_UNLOAD(ID)
gcode:
{% set ID = params.ID|default(0)|int %} # Extruder ID :: 0=extruder , 1=extruder1
M117 Macro EXTRUDER_UNLOAD ID:{ID}
{% if (printer.save_variables.variables.load_extruder == ID) %}
M117 Macro EXTRUDER_UNLOAD ID:{ID} unloading...
SAVE_GCODE_STATE NAME=unload_state
M117 UNLOAD_EXTR RAM={RAM} UNLOAD_DISTANCE={((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)}
G92 E0
G91 # relative positioning
M83
#G1 E{RAM} F300 # Ramming to help shape end
# See LOAD_EXTR for details of this segment
{% for i in range((((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)/100)|int) %}
G1 E-100 F3000
{% endfor %}
{% if (((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)%100) > 0 %}
G1 E{(((printer["gcode_macro UNLOAD_DISTANCE"].dist)|int)%100)*(-1)} F5000
{% endif %}
#G1 E-{RAM} F5000 #to account for the ramming filament
M82
G90 # absolute positioning
RESTORE_GCODE_STATE NAME=unload_state
SAVE_VARIABLE VARIABLE=load_extruder VALUE=-1
{% endif %}
# Nozzle length 13mm, White PTFE tube length is 27mm, Blue PTFE is 38mm long to split
[gcode_macro UNLOAD_DISTANCE]
description: Unload Distance - Nozzle length 13mm, White PTFE tube length is 27mm, Blue PTFE is 38mm long to split
variable_dist: 80
gcode:
{% set ULDIST = params.ULDIST|default(80)|float %}
{ action_respond_info("UNLOAD_DISTANCE params.ULDIST=%s" % (ULDIST)) }
#SET_GCODE_VARIABLE MACRO=EXTRUDER_VARS VARIABLE=unload_dist VALUE={ULDIST}
SET_GCODE_VARIABLE MACRO=UNLOAD_DISTANCE VARIABLE=dist VALUE={ULDIST}
SAVE_VARIABLE VARIABLE=unload_distance VALUE={ULDIST}
RESPOND MSG="UNLOAD_DISTANCE: {ULDIST}"
#RESPOND MSG="UNLOAD_DISTANCE.dist: {(printer["gcode_macro UNLOAD_DISTANCE"].dist)}"
#RESPOND MSG="EXTRUDER_VARS.unload_dist: {((printer["gcode_macro EXTRUDER_VARS"].unload_dist)|float)}"