Rev 966 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 966 | Rev 973 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | #include "main.h" |
15 | #include "main.h" |
16 | #include "FlightControl.h" |
16 | #include "FlightControl.h" |
Line 17... | Line 17... | ||
17 | 17 | ||
18 | - | ||
19 | int UBat = 100; /* Initial Battery Guess */ |
- | |
20 | int AdWertNick = 0, AdWertRoll = 0, AdWertGier = 0; |
18 | |
- | 19 | int UBat = 100; /* Initial Battery Guess */ |
|
21 | int AdWertAccRoll = 0,AdWertAccNick = 0,AdWertAccHoch = 0; |
20 | int AdWertNick_Raw = 0, AdWertRoll_Raw = 0, AdWertGier_Raw = 0; |
Line 22... | Line 21... | ||
22 | int AdWertNick_Raw = 0, AdWertRoll_Raw = 0, AdWertGier_Raw = 0; |
21 | int AdWertAccRoll = 0,AdWertAccNick = 0,AdWertAccHoch = 0; |
23 | int AdWertAccRoll_Raw = 0,AdWertAccNick_Raw = 0,AdWertAccHoch_Raw = 0; |
22 | int AdWertAccRoll_Raw = 0,AdWertAccNick_Raw = 0,AdWertAccHoch_Raw = 0; |
24 | 23 | ||
25 | int AccumulatedACC_X = 0, AccumulatedACC_Y = 0, AccumulatedACC_Z = 0, AccumulatedAirPressure = 0; |
24 | int AccumulatedACC_X = 0, AccumulatedACC_Y = 0, AccumulatedACC_Z = 0, AccumulatedAirPressure = 0; |
Line 26... | Line 25... | ||
26 | int AccumulatedACC_X_cnt = 0, AccumulatedACC_Y_cnt = 0, AccumulatedACC_Z_cnt = 0, AccumulatedAirPressure_cnt = 0; |
25 | int AccumulatedACC_X_cnt = 0, AccumulatedACC_Y_cnt = 0, AccumulatedACC_Z_cnt = 0, AccumulatedAirPressure_cnt = 0; |
Line 27... | Line 26... | ||
27 | int AccumulatedRoll_X = 0, AccumulatedRoll_Y = 0, AccumulatedRoll_Z = 0; |
26 | int AccumulatedRoll = 0, AccumulatedNick = 0, AccumulatedGier = 0; |
28 | int AccumulatedRoll_X_cnt = 0, AccumulatedRoll_Y_cnt = 0, AccumulatedRoll_Z_cnt = 0; |
27 | int AccumulatedRoll_cnt = 0, AccumulatedNick_cnt = 0, AccumulatedGier_cnt = 0; |
Line 90... | Line 89... | ||
90 | static unsigned char kanal=0,state = 0; |
89 | static unsigned char kanal=0,state = 0; |
91 | ANALOG_OFF; |
90 | ANALOG_OFF; |
92 | switch(state++) |
91 | switch(state++) |
93 | { |
92 | { |
94 | case 0: |
93 | case 0: |
95 | AdWertGier = ADC; |
- | |
96 | AdWertGier_Raw = ADC; |
94 | AdWertGier_Raw = ADC; |
97 | AccumulatedRoll_Z += (ADC - AdNeutralGier); |
95 | AccumulatedGier += (ADC - AdNeutralGier); |
98 | AccumulatedRoll_Z_cnt++; |
96 | AccumulatedGier_cnt++; |
99 | kanal = 1; |
97 | kanal = 1; |
100 | break; |
98 | break; |
101 | case 1: |
99 | case 1: |
102 | AdWertRoll = ADC; |
- | |
103 | AdWertRoll_Raw = ADC; |
100 | AdWertRoll_Raw = ADC; |
104 | AccumulatedRoll_X += (ADC - AdNeutralRoll); |
101 | AccumulatedRoll += (ADC - AdNeutralRoll); |
105 | AccumulatedRoll_X_cnt++; |
102 | AccumulatedRoll_cnt++; |
106 | kanal = 2; |
103 | kanal = 2; |
107 | break; |
104 | break; |
108 | case 2: |
105 | case 2: |
109 | AdWertNick = ADC; |
- | |
110 | AdWertNick_Raw = ADC; |
106 | AdWertNick_Raw = ADC; |
111 | AccumulatedRoll_Y += (ADC - AdNeutralNick); |
107 | AccumulatedNick += (ADC - AdNeutralNick); |
112 | AccumulatedRoll_Y_cnt++; |
108 | AccumulatedNick_cnt++; |
113 | kanal = 4; |
109 | kanal = 4; |
114 | break; |
110 | break; |
115 | case 3: |
111 | case 3: |
116 | #ifdef INTERNAL_REFERENCE |
112 | #ifdef INTERNAL_REFERENCE |
117 | UBat = (3 * UBat + (5 * ADC) / 9) / 4; /* The internal Voltage is 5V instesd of 3V */ |
113 | UBat = (3 * UBat + (5 * ADC) / 9) / 4; /* The internal Voltage is 5V instesd of 3V */ |