Rev 1731 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1731 | Rev 1738 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | signed char ExpandBaro = 0; |
22 | signed char ExpandBaro = 0; |
23 | volatile int VarioMeter = 0; |
23 | volatile int VarioMeter = 0; |
24 | volatile unsigned int ZaehlMessungen = 0; |
24 | volatile unsigned int ZaehlMessungen = 0; |
25 | unsigned char AnalogOffsetNick = 115,AnalogOffsetRoll = 115,AnalogOffsetGier = 115; |
25 | unsigned char AnalogOffsetNick = 115,AnalogOffsetRoll = 115,AnalogOffsetGier = 115; |
26 | volatile unsigned char AdReady = 1; |
26 | volatile unsigned char AdReady = 1; |
27 | float NeutralAccZ_float; |
27 | //float NeutralAccZ_float; // MartinR : wozu ? |
28 | //####################################################################################### |
28 | //####################################################################################### |
29 | // |
29 | // |
30 | void ADC_Init(void) |
30 | void ADC_Init(void) |
31 | //####################################################################################### |
31 | //####################################################################################### |
32 | { |
32 | { |
Line 140... | Line 140... | ||
140 | // |
140 | // |
141 | ISR(ADC_vect) |
141 | ISR(ADC_vect) |
142 | //####################################################################################### |
142 | //####################################################################################### |
143 | { |
143 | { |
144 | static unsigned char kanal=0,state = 0; |
144 | static unsigned char kanal=0,state = 0; |
145 | static signed char subcount = 0; |
145 | //static signed char subcount = 0; // MartinR: wird nicht mehr benötigt, da deaktiviert |
146 | static signed int gier1, roll1, nick1, nick_filter, roll_filter; |
146 | static signed int gier1, roll1, nick1, nick_filter, roll_filter; |
147 | static signed int accy, accx; |
147 | static signed int accy, accx; |
148 | static long tmpLuftdruck = 0; |
148 | static long tmpLuftdruck = 0; |
149 | static char messanzahl_Druck = 0; |
149 | static char messanzahl_Druck = 0; |
150 | switch(state++) |
150 | switch(state++) |
Line 183... | Line 183... | ||
183 | UBat = (3 * UBat + ADC / 3) / 4; |
183 | UBat = (3 * UBat + ADC / 3) / 4; |
184 | kanal = AD_ACC_Z; |
184 | kanal = AD_ACC_Z; |
185 | break; |
185 | break; |
186 | case 8: |
186 | case 8: |
187 | AdWertAccHoch = (signed int) ADC - NeutralAccZ; |
187 | AdWertAccHoch = (signed int) ADC - NeutralAccZ; |
- | 188 | ||
- | 189 | /* // MartinR: deaktivieren Anfang |
|
- | 190 | |
|
188 | if(AdWertAccHoch > 1) |
191 | if(AdWertAccHoch > 1) |
189 | { |
192 | { |
190 | if(NeutralAccZ < 750) |
193 | if(NeutralAccZ < 750) |
191 | { |
194 | { |
192 | subcount += 5; |
195 | subcount += 5; |
Line 201... | Line 204... | ||
201 | subcount -= 5; |
204 | subcount -= 5; |
202 | if(modell_fliegt < 500) subcount -= 10; |
205 | if(modell_fliegt < 500) subcount -= 10; |
203 | if(subcount < -100) { NeutralAccZ--; subcount += 100;} |
206 | if(subcount < -100) { NeutralAccZ--; subcount += 100;} |
204 | } |
207 | } |
205 | } |
208 | } |
- | 209 | |
|
- | 210 | */ // MartinR: deaktivieren Ende |
|
- | 211 | ||
206 | messanzahl_AccHoch = 1; |
212 | messanzahl_AccHoch = 1; |
207 | Aktuell_az = ADC; |
213 | Aktuell_az = ADC; |
208 | Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
214 | Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
209 | Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
215 | Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
210 | kanal = AD_DRUCK; |
216 | kanal = AD_DRUCK; |
Line 238... | Line 244... | ||
238 | case 15: |
244 | case 15: |
239 | nick1 += ADC; |
245 | nick1 += ADC; |
240 | if(PlatinenVersion == 10) nick1 *= 2; else nick1 *= 4; |
246 | if(PlatinenVersion == 10) nick1 *= 2; else nick1 *= 4; |
241 | AdWertNick = nick1 / 8; |
247 | AdWertNick = nick1 / 8; |
242 | nick_filter = (nick_filter + nick1) / 2; |
248 | nick_filter = (nick_filter + nick1) / 2; |
243 | HiResNick = nick_filter - AdNeutralNick; |
249 | //HiResNick = nick_filter - AdNeutralNick; // MartinR: so war es |
- | 250 | HiResNick = (nick_filter - AdNeutralNick + 4 ) / 8 ; // MartinR: + 4um Rundungsfehler zu verbessern |
|
- | 251 | // MartinR: /8 von fc.c nach hier verschoben um Code zu sparen |
|
244 | AdWertNickFilter = (AdWertNickFilter + HiResNick) / 2; |
252 | AdWertNickFilter = (AdWertNickFilter + HiResNick) / 2; |
245 | kanal = AD_ROLL; |
253 | kanal = AD_ROLL; |
246 | break; |
254 | break; |
247 | case 16: |
255 | case 16: |
248 | roll1 += ADC; |
256 | roll1 += ADC; |
249 | if(PlatinenVersion == 10) roll1 *= 2; else roll1 *= 4; |
257 | if(PlatinenVersion == 10) roll1 *= 2; else roll1 *= 4; |
250 | AdWertRoll = roll1 / 8; |
258 | AdWertRoll = roll1 / 8; |
251 | roll_filter = (roll_filter + roll1) / 2; |
259 | roll_filter = (roll_filter + roll1) / 2; |
252 | HiResRoll = roll_filter - AdNeutralRoll; |
260 | HiResRoll = roll_filter - AdNeutralRoll; // MartinR: so war es |
- | 261 | HiResRoll = (roll_filter - AdNeutralRoll + 4 ) / 8; // MartinR: + 4um Rundungsfehler zu verbessern |
|
- | 262 | // MartinR: /8 von fc.c nach hier verschoben um Code zu sparen |
|
253 | AdWertRollFilter = (AdWertRollFilter + HiResRoll) / 2; |
263 | AdWertRollFilter = (AdWertRollFilter + HiResRoll) / 2; |
254 | kanal = AD_DRUCK; |
264 | kanal = AD_DRUCK; |
255 | break; |
265 | break; |
256 | case 17: |
266 | case 17: |
257 | state = 0; |
267 | state = 0; |