-
Notifications
You must be signed in to change notification settings - Fork 0
/
orbiter_sensor.cfg
246 lines (220 loc) · 14.3 KB
/
orbiter_sensor.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
241
#################################################################################################################
################################# Orbiter Sensor CONFIGURATION ##################################################
#################################################################################################################
#config file version v2.2.04
#release date: 23.09.2023
# PAUSE and RESUME macros are defined at the end of this config file.
# If you prefer using your own p[lease delete them, otherwise define parking position below.
#################################################################################################################
################################# CHANGE HERE MACRO CONFIGURABLES################################################
#################################################################################################################
[gcode_macro _ORBITER_SENSOR_VARIABLES] # change here macro configurables, enable disable functions!*************************
variable_filament_load_temp :200 # temperature to heat up hotend for filament loading, default is 235
variable_filament_unload_temp :185 # temperature to heat up hotend for filament un-loading, default is 185
variable_filament_load_min_temp :190 # minimum hotend set temperature allowed in filament load macro, default is 190
variable_nozzle_purge_length :100 # filament extrude amount during load sequenc, hotend purge from old filament, default is 200
variable_nozzle_purge_speed :450 # filament extrude speed in mm/min adjust this value lower if flow is too high and extruder skips during loading, default is 300
variable_unload_distance :65 # filament retract distance for unload procedure. this length shall be long enough to extract the filament above the drive gears
variable_disable_autoload :False # disable filament autoload feature by setting this variable True
variable_disable_runnout :False # disable runnout by setting this variable True
variable_disable_autounload :False # disable auto unload filament by setting this variable to True
variable_enable_beep :True # uses M300 sound feature, set it True to enable
variable_park_position_x :230 # edit your X parking position here for pause macro trigerred by runnout
variable_park_position_y :10 # edit your Y parking position here for pause macro trigerred by runnout
variable_park_lift_z :10 # edit your Z lift amount for parking position here, default is 10
Variable_park_retraction :1 # edit your retraction amount for parking, default is 1
gcode:
#################################################################################################################################
####################################### DO NOT CHANGE ANYTHING BELOW THIS LINE!!! ###############################################
#################################################################################################################################
####################################### UNLESS YOU KNOW WHAT YOU ARE DOING OR YOU ARE BORED AND NEED TO DO SOMETHING OR YOU ARE ALONE AND NEED SOMETHING TO MESS UP YOUR LIFE OR YOU CAN DO IT BETTER THAN ME OR YOU ARE A REAL SMARTASS OR JUST BECAUSE YOU CAN OR YOU RUN OUT OF BEAR OR HAS NOTHING BETTER TO DO OR ANY UNREASONABLE REASON
#################################################################################################################################
[gcode_macro runnout_init]
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if (printer.print_stats.state == "printing") %}
{% if(sensor.disable_runnout|lower == 'false') %}
filament_change_state1
{% else %}
M118 Filament runnout is disabled in the sensor config file!
{% endif %}
{% endif %}
UPDATE_DELAYED_GCODE ID=clear_loadbusy DURATION=2
UPDATE_DELAYED_GCODE ID=clear_unloadbusy DURATION=2
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=filamentpresent VALUE=0
[gcode_macro filament_change_state1]
variable_changebusy: 0
variable_temp_target: 0
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if changebusy == 0 %}
PAUSE # call printer pause macro
SET_GCODE_VARIABLE MACRO=filament_change_state1 VARIABLE=changebusy VALUE=1
M118 Filament runnout!
filament_change_state2 # comment this line if you do not want to automatically unload filament in case there is a runnout detected.
{% else %}
{% endif %}
[gcode_macro filament_change_state2]
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=1
{% if (sensor.enable_beep|lower == 'true') %}
M300 # beep sound
{% endif %}
M118 Unloading filament...
M83
G92 E0
# {% if printer[printer.toolhead.extruder].temperature < 185 %} # hardcoded threshold
{% if (printer.extruder.can_extrude|lower != 'true')%} # checing for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
M118 Hotend heating!
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={sensor.filament_unload_temp} # restore user temp if it was set before loading
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={sensor.filament_unload_temp} #wait for reaching filament unload temp
{% endif %}
{% if(printer.extruder.target == 0) %} # checing for set temperature if is zero than set to 200 / hotend hot but cooling due to set target temp 0
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={sensor.filament_unload_temp} # restore user temp if it was set before loading
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={sensor.filament_unload_temp} #wait for reaching filament unload temp
{% endif %}
G0 E-5 F3600 #extract filament to cold end
G4 P2000 # wait for two seconds
G0 E5 F3600 # push the filament back
G0 E-5 F3600 #extract filament to cold end
G0 E-{sensor.unload_distance} F300 # continue extraction slow allow filament to be cooled enough before reaches the gears
M400
M118 Load new filament! Wait until is loaded, then resume printing.
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0 # swicth off heater
UPDATE_DELAYED_GCODE ID=clear_loadbusy DURATION=2.5 # timing must be set to clear delay plus 0.5s. is due to wait to remove filament before starting load even in case there is a blob at the tip of the extracted filament which woudl trigger the sensor twice
#############################################END filament auto load macro section END***********************************************************
[gcode_macro filament_load_init]
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if (printer.print_stats.state != "printing") %}
{% if(sensor.disable_autoload|lower == 'false') %}
filament_load
{% else %}
M118 Filament auto-load is disabled in the sensor config file!
{% endif %}
{% else %}
M118 Printing! Can't load filament right now!
{% endif %}
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=filamentpresent VALUE=1
UPDATE_DELAYED_GCODE ID=clear_changebusy DURATION=2
[gcode_macro filament_load]
variable_loadbusy: 0
variable_USER_TEMP: 0
variable_LOAD_TEMP: 0
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if loadbusy == 0 %} # requires [virtual_sdcard]
SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=1
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=unloadbusy VALUE=1
{% set USER_TEMP = printer.extruder.target %} # save user set temperature before loading
{% set LOAD_TEMP = 0 %}
#M118 USER TEMP {USER_TEMP} # echo back for debug only
{% if (printer.extruder.can_extrude|lower != 'true') or (printer.extruder.target < sensor.filament_load_min_temp) %} # checking for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={sensor.filament_load_temp} # set user defined load temperature
{% set LOAD_TEMP = sensor.filament_load_temp %} # save user set temperature before loading
M118 Hotend heating!
{% endif %}
{% if (sensor.enable_beep|lower == 'true') %}
M300 # beep sound
{% endif %}
M118 Filament loading!
M82 #set extruder to absolute mode
G92 E0
G4 P1500 # wait for 1.5 seconds
FORCE_MOVE STEPPER=extruder DISTANCE=15 VELOCITY=10 ACCEL=1000 # load filament inside the gears force move needs to be enabled
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={LOAD_TEMP} # wait for reaching set temperature
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={USER_TEMP} # wait for reaching set temperature
G1 E{sensor.nozzle_purge_length} F{sensor.nozzle_purge_speed} # extrude preconfigured purge length
M400 # wait to complete nozzle purge
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={USER_TEMP} # restore user temp if it was set before loading
M118 Filament load complete!
UPDATE_DELAYED_GCODE ID=clear_unloadbusy DURATION=2
{% else %}
M118 Filament already loaded!
{% endif %}
#############################################END filament suto load macro section END***********************************************************
#############################################filament auto unload macro section*****************************************************************
[gcode_macro filament_unload_init]
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if (printer.print_stats.state != "printing") %}
{% if(sensor.disable_autounload|lower == 'false') %}
filament_unload
{% else %}
M118 Filament auto-unload is disabled in the sensor config file!
{% endif %}
{% else %}
M118 Printing! Can't unload filament right now!
{% endif %}
[gcode_macro filament_unload]
variable_unloadbusy: 0
variable_filamentpresent: 0
gcode:
{% set sensor = printer['gcode_macro _ORBITER_SENSOR_VARIABLES'] %}
{% if unloadbusy == 0 %} # requires [virtual_sdcard]
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=unloadbusy VALUE=1
SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=1
{% if (sensor.enable_beep|lower == 'true') %}
M300 # beep sound
{% endif %}
M118 Filament unloading!
M83
G92 E0
# {% if (printer.extruder.can_extrude|lower != 'true') or (printer.extruder.target == 0)%} # checing for minimum extrusion temperature
{% if (printer.extruder.can_extrude|lower != 'true')%} # checing for minimum extrusion temperature
# check if temperature is over the minimum extrusion temp. min_extrude_temp must be defined in the extruder config (to about 185)
M118 Hotend heating!
SET_HEATER_TEMPERATURE HEATER=extruder TARGET={sensor.filament_unload_temp} # restore user temp if it was set before loading
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={sensor.filament_unload_temp} # wait for reaching configured unload temperature
{% endif %}
{% if(printer.extruder.target == 0) %} # checing for set temperature if is zero than set to 185 / hotend hot but cooling due to set target temp 0
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={sensor.filament_unload_temp} # wait for reaching configured unload temperature
{% endif %}
G0 E10 F500 # extruder 20mm of filament before extracting
G0 E-5 F3600 #extract filament to cold end
G4 P2000 # wait for two seconds
G0 E6 F3600 # push the filament back
G0 E-10 F3600 #extract filament to cold end
G0 E-{sensor.unload_distance} F300 # continue extraction slow allow filament to be cooled enough before reaches the gears
M104 S0 T0
M400 # wait to complete unload
M118 Filament unload complete!
#SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=0
{% else %}
M118 Nothing to unload!
{% endif %}
#############################################END filament auto unload macro section END***********************************************************
[delayed_gcode clear_unloadbusy]
gcode:
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=unloadbusy VALUE=0
#M118 Clear Unload busy!
[delayed_gcode clear_changebusy]
gcode:
SET_GCODE_VARIABLE MACRO=filament_change_state1 VARIABLE=changebusy VALUE=0
#M118 Clear Load busy!
[delayed_gcode set_loadbusy]
gcode:
SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=1
#M118 Set Load busy!
[delayed_gcode clear_loadbusy]
gcode:
SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=0
#M118 Clear Load busy!
# config file version v2.2.04 change note
# Commented ou the set Orbiled commands.
# config file version v2.2.03 change note
# 1 - defined user variables at the begining of the file for easier macro parameters adjustment
# 2 - defined disable configuration of features
# 3 - included PAUSE and RESUME macros with restoring bed and hotend temperature featres.
# config file version v2.2.02 change note
# 1 - filament loading will not set hotend temperature to zero in case the hotend was already set hot before the loading / filament change procedure
# 2 - Filament load / unload waits for hotend to reach temp not to reach stabilized temperature - faster filament loading and unloading.
# 3 - Removed messages to screen, only console echo is present
# 4 - Panel beep replaced by M300 / comment it out if not available on your printer
# 5 - unload procedure changed for better filament tip forming.
# 6 - known issue - if printer paused due to runout detection and new filament is not loaded whiting Klipper heaters timeout period (default is 10min) the heaters will be switched OFF.
# If user loads new filament autoload with work with its default loading temperature of 230 deg C but the heaters temperature will not be restored afterwards user needs to set back heaters temperature.
# on my printer this timeout also causes loosing of extruder position and printing can be resumed only after homing first and setting back temperatures manually.