-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheatbed.cfg
219 lines (184 loc) · 5.94 KB
/
heatbed.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
[heater_bed]
heater_pin: PB9
sensor_type: Generic 3950
sensor_pin: PC3
pullup_resistor: 4700
#control: watermark
#max_power: 1.0
min_temp: -100
max_temp: 130
[verify_heater heater_bed]
max_error: 120
check_gain_time:200
hysteresis: 10
heating_gain: 10
#AutoCalibration
[bed_mesh]
speed: 300
horizontal_move_z:2
move_check_distance: 5
mesh_min: -105, -105
mesh_max: 105, 105
probe_count: 5, 5
mesh_pps: 3, 3
algorithm: bicubic
bicubic_tension: 0.2
#fade_start: 3
#fade_end: 10
#fade_target: 0
[skew_correction]
[probe]
pin: !PB4
speed: 2
lift_speed: 5
samples: 1
[temperature_sensor Load_Cell]
sensor_type: MAX31856
sensor_pin: PD5
#spi_bus: spi4
spi_speed: 1000000
spi_software_sclk_pin: PD6
spi_software_mosi_pin: PD7
spi_software_miso_pin: PD8
min_temp: 0
max_temp: 2048
gcode_id: W
# reset the check_level_pin state
[output_pin _level_clear]
pin: PD10
value:0
# check level pin is triggered when load cell tare is set via level_h1 pin
[gcode_button _check_level_pin]
pin: !PE0
press_gcode:
G4 P0
# set load cell tare
[output_pin _level_h1]
pin:PG2
value:0
# don't use (!) - changes load cell calibration
[output_pin _level_h2]
pin:PG3
value:0
# don't use (!) - changes load cell calibration
[output_pin _level_h3]
pin:PG4
value:0
[gcode_macro AUTO_BED_LEVEL]
description: Move to temps and initiate Bed Mesh Calibrate
gcode:
{% set bed_temp = params.BED_TEMP|default(60)|float %}
{% set extruder_temp = params.EXTRUDER_TEMP|default(200)|float %}
{% set profile = params.PROFILE|default("auto") %}
{% set NOZZLE = 150 %} ; nozzle temp to use during bed level
# clear old mesh and home if necessary
BED_MESH_CLEAR
{% if not "xyz" in printer.toolhead.homed_axes %}
G28
{% endif %}
# bed heating
G90 ; absolute coordinates
G1 Z10 F1800 ; raise bed
M140 S{bed_temp - 2} ; set bed temp to lower temp just incase bed temp is already HOTTER.
# wait for bed to reach temp, if HOTTER; don't wait for stabilization
TEMPERATURE_WAIT SENSOR=heater_bed MAXIMUM={bed_temp}
M140 S{bed_temp} ; set bed temp
# wait for bed to reach temp, don't wait for stabilization
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bed_temp}
LOAD_CELL_TARE ; reset tare before manual probe
# nozzle heating
M104 S{extruder_temp} ; set nozzle temperature
# wait for nozzle to reach temp, don't wait for stabilization
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={extruder_temp}
# wipe to left
G90 ; absolute coordinates
G1 X50 Y110 Z5 F18000 ; get into position
PROBE ; moove nozzle to bed
G91 ; relative position
G1 X-40 F900 ; wipe move left
# wipe to right
G90 ; absolute coordinates
G1 X-50 Y110 Z5 F18000 ; get into position
PROBE ; moove nozzle to bed
G91 ; relative position
G1 X40 F900 ; wipe move right
# wait for nozzle cooldown to calibration temp
M106 S255 ; turn on fan
M104 S0 ; turn of noozle heating
TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={NOZZLE + 2}
M104 S{NOZZLE} ; turn nozzle heating on to 150
M107 ; turn off fan
# move to remove cold filament
G1 X10 F300
# start the calibration
BED_MESH_CALIBRATE PROFILE="{profile}"
[gcode_macro BED_MESH_CALIBRATE]
description: Begin bed mesh point checks
rename_existing: _BED_MESH_CALIBRATE_ORIG
gcode:
G90 ; absolute coordinates
G1 Z2 F1800 ; move noozle near bed
LOAD_CELL_TARE ; reset tare before leveling
_BED_MESH_CALIBRATE_ORIG {rawparams}
[gcode_macro Z_OFFSET_APPLY_ENDSTOP]
# This macro is replaced because saving the z-offset to the endstop would not have the expected outcome
# on this printer. The endstop is separate from the probe. After bed leveling before print, the offset
# would be ineffective.
rename_existing: _Z_OFFSET_APPLY_ENDSTOP
gcode:
RESPOND MSG="Notice: z-offset should not be saved to endstop on this printer. This command runs Z_OFFSET_APPLY_PROBE instead."
Z_OFFSET_APPLY_PROBE
[gcode_macro LOAD_CELL_TARE]
description: Zero out Load cell
variable_success: 0
gcode:
# reset success
SET_GCODE_VARIABLE MACRO=LOAD_CELL_TARE VARIABLE=success VALUE=0
# try set tare, up to 10 times
{% for i in range(10) %}
_LOAD_CELL_TARE_IF_NO_SUCCESS
{% endfor %}
# final check if successfull
_LOAD_CELL_TARE_FINAL_CHECK
[gcode_macro _LOAD_CELL_TARE_IF_NO_SUCCESS]
gcode:
{% if not printer["gcode_macro LOAD_CELL_TARE"].success %}
_LOAD_CELL_TARE_SET
_LOAD_CELL_TARE_CHECK
{% endif %}
[gcode_macro _LOAD_CELL_TARE_SET]
gcode:
# Tare is set by toggeling _level_h1 pin
SET_PIN PIN=_level_h1 VALUE=0
G4 P500
M400
SET_PIN PIN=_level_h1 VALUE=1
G4 P500
M400
SET_PIN PIN=_level_h1 VALUE=0
G4 P500
M400
SET_PIN PIN=_level_h1 VALUE=1
G4 P500
M400
[gcode_macro _LOAD_CELL_TARE_CHECK]
gcode:
# If level check pin is set, tare is successfull.
{% if "PRESSED" in printer['gcode_button _check_level_pin'].state %}
SET_GCODE_VARIABLE MACRO=LOAD_CELL_TARE VARIABLE=success VALUE=1
{% endif %}
[gcode_macro _LOAD_CELL_TARE_FINAL_CHECK]
gcode:
# Check success
{% if printer["gcode_macro LOAD_CELL_TARE"].success %}
# Toggle level clear plin.
# No sure what the level clear pin does. But we do the same as the stock software.
SET_PIN PIN=_level_clear VALUE=0
G4 P10
M400
SET_PIN PIN=_level_clear VALUE=1
RESPOND TYPE=echo MSG="Load cell tare success."
# Else raise error
{% else %}
{action_raise_error("Load cell tare failed.")}
{% endif %}