forked from nanomonkey/KS_100kW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.pde
154 lines (146 loc) · 3.32 KB
/
Test.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
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
void TransitionTesting(int new_state) {
testing_state_entered = millis();
Serial.print("#Switching to testing state:");
Serial.println(TestingStateName[new_state]);
switch (new_state) {
case TESTING_OFF:
break;
case TESTING_FET0:
analogWrite(FET0,255);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET1:
analogWrite(FET0,0);
analogWrite(FET1,255);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET2:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,255);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET3:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,255);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET4:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,255);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET5:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,255);
analogWrite(FET6,0);
analogWrite(FET7,0);
break;
case TESTING_FET6:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,255);
analogWrite(FET7,0);
break;
case TESTING_FET7:
analogWrite(FET0,0);
analogWrite(FET1,0);
analogWrite(FET2,0);
analogWrite(FET3,0);
analogWrite(FET4,0);
analogWrite(FET5,0);
analogWrite(FET6,0);
analogWrite(FET7,255);
break;
case TESTING_ANA_EO2:
break;
case TESTING_ANA_FO2:
break;
case TESTING_ANA_FUEL_SWITCH:
break;
case TESTING_ANA_POT1:
break;
case TESTING_ANA_POT2:
break;
}
testing_state=new_state;
}
void GoToNextTestingState() {
switch (testing_state) {
case TESTING_OFF:
TransitionTesting(TESTING_FET0);
break;
case TESTING_FET0:
TransitionTesting(TESTING_FET1);
break;
case TESTING_FET1:
TransitionTesting(TESTING_FET2);
break;
case TESTING_FET2:
TransitionTesting(TESTING_FET3);
break;
case TESTING_FET3:
TransitionTesting(TESTING_FET4);
break;
case TESTING_FET4:
TransitionTesting(TESTING_FET5);
break;
case TESTING_FET5:
TransitionTesting(TESTING_FET6);
break;
case TESTING_FET6:
TransitionTesting(TESTING_FET7);
break;
case TESTING_FET7:
TransitionTesting(TESTING_ANA_EO2);
break;
case TESTING_ANA_EO2:
TransitionTesting(TESTING_ANA_FO2);
break;
case TESTING_ANA_FO2:
TransitionTesting(TESTING_ANA_FUEL_SWITCH);
break;
case TESTING_ANA_FUEL_SWITCH:
TransitionTesting(TESTING_ANA_POT1);
break;
case TESTING_ANA_POT1:
TransitionTesting(TESTING_ANA_POT2);
break;
case TESTING_ANA_POT2:
TransitionTesting(TESTING_OFF);
break;
}
}