-
Notifications
You must be signed in to change notification settings - Fork 0
/
FastAirlockWOverride.ic10
128 lines (127 loc) · 2.92 KB
/
FastAirlockWOverride.ic10
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
alias dDoorIn d0
alias dDoorOut d1
alias dVentIn d2
alias dVentOut d3
alias dOverride1 d4 # manual override lever 1 (both need to be active for manual override)
alias dOverride2 d5 # manual override lever 2 (both need to be active for manual override)
define GASSENSOR -1252983604
define MOTIONSENSOR -1713470563
alias openDoor r15
alias activated r14
alias pressure r13
alias overrideActive r12
alias temperature r11
define DVENTIN 2
define DVENTOUT 3
define CRITHIGHTEMP 323 #50 degree, will close all doors when manual mode is active and this temperature is exceeded
define CRITLOWTEMP 288 #15 degree, will close all doors when manual mode is active and this temperature is exceeded
s dDoorIn Lock 0
s dDoorOut Lock 0
s dVentIn Setting 100
s dVentIn Lock 1
s dVentIn Mode 1
s dVentIn PressureExternal 0
s dVentIn PressureInternal 10000000
s dVentIn On 0
s dVentOut Setting 100
s dVentOut Lock 1
s dVentOut Mode 1
s dVentOut PressureExternal 0
s dVentOut PressureInternal 10000000
s dVentOut On 0
l r3 dDoorIn Open
s dDoorIn Setting r3
l r3 dDoorOut Open
s dDoorOut Setting r3
alias noPerson r4
move noPerson 1
loop: # MAIN loop
yield
bdns dDoorIn error
bdns dDoorOut error
bdns dVentIn error
bdns dVentOut error
lb pressure GASSENSOR Pressure 1 #Batch sum
lb temperature GASSENSOR Temperature 0 #Batch Average
jal checkOverride # check for manual override
bnez overrideActive manualOverride
s dDoorIn Mode 1
s dDoorOut Mode 1
jal resetPerson
l activated dDoorOut Setting
l r3 dDoorOut Open
sne activated activated r3
bnez activated run
l r3 dDoorIn Open
l activated dDoorIn Setting
sne activated activated r3
bnez activated run
lb activated MOTIONSENSOR Activate 3# Batch Max
add r7 noPerson activated
beq r7 2 run
j loop
resetPerson:
lb activated MOTIONSENSOR Activate 3# Batch Max
bnez activated ra
move noPerson 1
j ra
run:
move noPerson 0
l openDoor dDoorOut Open
s dDoorOut Lock 1
s dDoorIn Lock 1
beqz openDoor runToOut
j runToIn
runToIn: # opens the inner door
s dDoorOut Open 0
s dDoorOut Setting 0
move r8 DVENTOUT
jal activateVent
sleep 2
s dDoorIn Open 1
s dDoorIn Setting 1
j runFinish
runToOut: # opens outer door
s dDoorIn Open 0
s dDoorIn Setting 0
move r8 DVENTIN
jal activateVent
sleep 2
s dDoorOut Open 1
s dDoorOut Setting 1
j runFinish
activateVent: # activates current Vent
s dr8 On 1
innerLoop: # Depressurize Loop
lb pressure GASSENSOR Pressure 1 # Batch Sum
bgt pressure 0 innerLoop
s dr8 On 0
j ra
runFinish: # runFinish
s dDoorOut Lock 0
s dDoorIn Lock 0
j loop
manualOverride: #Activates manual Control of doors
s dDoorIn Lock 0
s dDoorOut Lock 0
s dDoorIn Mode 0
s dDoorOut Mode 0
s dVentIn On 0
s dVentOut On 0
bgt temperature CRITHIGHTEMP EmergencyProtocol
blt temperature CRITLOWTEMP EmergencyProtocol
j loop
checkOverride:
move overrideActive 0
bdns dOverride1 ra
bdns dOverride2 ra
l overrideActive dOverride1 Setting
l r0 dOverride2 Setting
and overrideActive overrideActive r0
j ra
EmergencyProtocol:
s dDoorOut Open 0
s dDoorIn Open 0
j loop
error:
asd