/
job-prologue.g
78 lines (61 loc) · 1.74 KB
/
job-prologue.g
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
M98 R1
if !exists(global.probe_block_detach)
global probe_block_detach = false
set global.probe_block_detach = false
G21 ;metric values
G90 ;absolute positioning
M83 ;relative extrusion
M107 ;start with the fan off
G92 E0 ;zero the extruded length
M150 E1 R255 P192 S1 F0
;G10 P0 S{param.T} R50; start preheat hotend_0
M140 S{param.H} ; start preheating the bed
var mmu = false
if exists(param.S)
set var.mmu = true
M98 P"mmu/lib/load-tool.g" T{param.S}
M190 S{param.H}
var rollingAverage = heat.heaters[0].avgPwm
var sampleCount = 60
if heat.heaters[0].state == "active" && heat.heaters[0].active >= 100
while iterations < 10 || var.rollingAverage > 0.28
G4 S1
set var.rollingAverage = var.rollingAverage - var.rollingAverage / var.sampleCount + heat.heaters[0].avgPwm / var.sampleCount
if mod(iterations, 60) == 0
echo "Waiting for bed heater to settle: " ^ var.rollingAverage ^ " > 0.28"
M150 E1 U255 B255 P192 S1 F0
set global.probe_block_detach = true
var need_g32 = false
if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
set var.need_g32 = true
G28
if result != 0
abort "Homing failed"
else
G28 Z
if result != 0
abort "Homing failed"
if var.need_g32
set global.probe_block_detach = false
M402
M98 P"k/brush-nozzle.g"
M401
set global.probe_block_detach = true
G32
if result != 0
abort "QGL failed"
set global.probe_block_detach = false
G10 P0 S{param.T} R50; start preheat hotend_0 can be later because rapido heats so rapidly
if var.need_g32
G29
M402
if result != 0
abort "Mesh failed"
M116 P0
if var.mmu
G1 E50 F300
M98 P"k/clean-nozzle.g"
G1 X297 Y150 Z1 F12000
G1 Y50 Z{param.L} E30 F500 ;intro line
G92 E0 ;zero the extruded length again
M150 E1 W255 P192 S1 F0