-
Notifications
You must be signed in to change notification settings - Fork 2
/
Reactor.pde
53 lines (50 loc) · 1.37 KB
/
Reactor.pde
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
void DoFlare() {
switch (flare_state) {
case FLARE_OFF:
break;
case FLARE_USER_SET:
if (P_reactorLevel != OFF && engine_state != ENGINE_ON) {
ignitor_on = true;
analogWrite(FET_FLARE_IGNITOR,255);
} else {
ignitor_on = false;
analogWrite(FET_FLARE_IGNITOR,0);
}
break;
}
#if FET_BLOWER != ABSENT
blower_dial = analogRead(ANA_BLOWER_DIAL);
analogWrite(FET_BLOWER,blower_dial/4);
#endif
}
void DoReactor() {
//TODO:Refactor
//Define reactor condition levels
for(int i = 0; i < TEMP_LEVEL_COUNT; i++) {
if (Temp_Data[T_TRED] > T_tredLevelBoundary[i][0] && Temp_Data[T_TRED] < T_tredLevelBoundary[i][1]) {
T_tredLevel = (TempLevels) i;
}
}
for(int i = 0; i < TEMP_LEVEL_COUNT; i++) {
if (Temp_Data[T_BRED] > T_bredLevelBoundary[i][0] && Temp_Data[T_BRED] < T_bredLevelBoundary[i][1]) {
T_bredLevel = (TempLevels) i;
}
}
for(int i = 0; i < P_REACTOR_LEVEL_COUNT; i++) {
if (Press[P_REACTOR] > P_reactorLevelBoundary[i][0] && Press[P_REACTOR] < P_reactorLevelBoundary[i][1]) {
P_reactorLevel = (P_reactorLevels) i;
}
}
// switch (reactor_state) {
// case REACTOR_OFF:
// break;
// case REACTOR_IGNITING:
// break;
// case REACTOR_WARMING:
// break;
// case REACTOR_COOLING:
// break;
// case REACTOR_WARM:
// break;
// }
}