forked from allpowerlabs/KS_PowerPallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reactor.pde
57 lines (53 loc) · 1.69 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
53
54
55
56
void DoFlare() {
switch (flare_state) {
case FLARE_OFF:
break;
case FLARE_USER_SET:
if (
P_reactorLevel > OFF &&
//T_tredLevel > COLD &&
engine_state == ENGINE_OFF
) {
ignitor_on = true;
digitalWrite(FET_FLARE_IGNITOR,HIGH);
} else {
ignitor_on = false;
digitalWrite(FET_FLARE_IGNITOR,LOW);
}
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;
}
}
// P_ratio calculations - moved from Grate.pde
pRatioReactor = (float)Press[P_COMB]/(float)Press[P_REACTOR];
if (pRatioReactor > pRatioReactorLevelBoundary[PR_LOW][0] && pRatioReactor < pRatioReactorLevelBoundary[PR_LOW][1]) {
pRatioReactorLevel = PR_LOW;
}
if (pRatioReactor > pRatioReactorLevelBoundary[PR_CORRECT][0] && pRatioReactor < pRatioReactorLevelBoundary[PR_CORRECT][1]) {
pRatioReactorLevel = PR_CORRECT;
}
if (pRatioReactor > pRatioReactorLevelBoundary[PR_HIGH][0] && pRatioReactor < pRatioReactorLevelBoundary[PR_HIGH][1]) {
pRatioReactorLevel = PR_HIGH;
}
}