-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrbiterSensor.cfg
185 lines (163 loc) · 8 KB
/
OrbiterSensor.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
#####################################################
################# Orbiter Sensor #####################
######################################################
#config file version v2.2
[respond]
default_type: echo
[delayed_gcode clear_display]
gcode:
M117 # clear display message
[force_move]
enable_force_move: True
#///////////////////////////filament sensor button macros/////////////////////////////////////////////////
[gcode_button sensor_fs]
# !!!!!!!!!!!!!!!!!!!!!change with the pin name to which the sensor is connected!!!!!!!!!!!!!!!!!!!!!
pin: PD2 # remove the negation "!" for sensor v1 - use just PC9 as example
press_gcode: # sensor released
{% if (printer.print_stats.state == "printing") %}
#PAUSE # call printer pause macto
filament_change_state1
#{% else %}
# SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=0
{% 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
release_gcode: #gcode macro for filament load, sensor pressed
{% if (printer.print_stats.state != "printing") %}
filament_load
{% else %}
M117 Printing! Can't load filament right now!
M118 Printing! Can't load filament right now!
UPDATE_DELAYED_GCODE ID=clear_display DURATION=10
{% endif %}
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=filamentpresent VALUE=1
UPDATE_DELAYED_GCODE ID=clear_changebusy DURATION=2
#********************************************************************************************************
#////////////////////////////////////////Filament Unload macros/////////////////////////////////////////////////
[gcode_button sensor_fu]
# !!!!!!!!!!!!!!!!!!!!!!!change with the pin name to which the sensor is connected!!!!!!!!!!!!!!!!!!!!!
pin: PJ0 # remove the negation "!" for sensor v1 - use just PA10 as example
release_gcode: # filament unload procedure
{% if (printer.print_stats.state != "printing")%} # requires [virtual_sdcard]
filament_unload
{% else %}
M117 Printing! Can't unload filament right now!
M118 Printing! Can't unload filament right now! #M117 message to display
{% endif %}
press_gcode: # do not add any macro call here
#**************************************************************************************************************
[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!
[gcode_macro filament_change_state1]
variable_changebusy: 0
gcode:
{% if changebusy == 0 %}
PAUSE # call printer pause macro
SET_GCODE_VARIABLE MACRO=filament_change_state1 VARIABLE=changebusy VALUE=1
M118 Filament runnout!
M117 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_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=1
#PANEL_BEEP # only for panel due
M118 Unloading filament...
M117 Unloading filament...
M82 #set extruder to absolute mode
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!
M109 S235 T0 # set temperature and wait
{% endif %}
G0 E-5 F3600 #extract filament to cold end
G0 E-70 F300 # continue extraction slow allow filament to be cooled enough before reaches the gears
#G0 E-20 F300 # for fast testing only
M400
M117 Load new filament! Wait until is loaded, then resume printing.
M118 Load new filament! Wait until is loaded, then resume printing.
#SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=0
UPDATE_DELAYED_GCODE ID=set_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
[gcode_macro filament_load]
variable_loadbusy: 0
gcode:
{% 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
{% 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)
M104 S235 T0 # set temperature and wait, 235 deg C is a good value for most of filament types.
{% endif %}
#PANEL_BEEP # only for panel due
M117 Filament loading!
M118 Filament loading!
M82 #set extruder to absolute mode
G92 E0
G4 P2000 # wait for two seconds
FORCE_MOVE STEPPER=extruder DISTANCE=15 VELOCITY=5 ACCEL=1000 # load filament inside the gears force move needs to be enabled
# check for extruder ready - hotend temperature is high enough, extrude 50mm then check temperature again. To avoid cold extrusion when filament load was started with hot hotend but temperature set to 0
{% 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!
M109 S235 T0 # set temperature and wait, 235 deg C is a good value for most of filament types.
{% endif %}
G1 E200 F300 # extrude 200mm
M400
{% if (printer.print_stats.state != "printing") and (printer.print_stats.state != "paused")%}
M104 S0 T0 # if not printing or paused due to filament change set the extruder temp to 0
{% endif %}
M117 Filament load complete!
M118 Filament load complete!
UPDATE_DELAYED_GCODE ID=clear_display DURATION=10
UPDATE_DELAYED_GCODE ID=clear_unloadbusy DURATION=2
{% else %}
M118 Filament already loaded!
{% endif %}
[gcode_macro filament_unload]
variable_unloadbusy: 0
variable_filamentpresent: 0
gcode:
#{% if unloadbusy == 0 and filamentpresent == 1 %} # requires [virtual_sdcard]
{% 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
#PANEL_BEEP # only for panel due
M118 Filament unloading!
M117 Filament unloading!
M82 #set extruder to absolute mode
G92 E0
{% 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!
M109 S235 T0 # set temperature and wait
{% endif %}
G0 E-5 F3600 #extract filament to cold end
G0 E-70 F300 # continue extraction slow allow filament to be cooled enough before reaches the gears
#G0 E-20 F300 # for fast testing only
M104 S0 T0
M400
M118 Filament unload complete!
M117 Filament unload complete!
#SET_GCODE_VARIABLE MACRO=filament_load VARIABLE=loadbusy VALUE=0
UPDATE_DELAYED_GCODE ID=clear_display DURATION=10
{% else %}
M118 Nothing to unload!
{% endif %}
[delayed_gcode clear_unloadbusy]
gcode:
SET_GCODE_VARIABLE MACRO=filament_unload VARIABLE=unloadbusy VALUE=0
#M118 Clear Unload busy!