Rev 701 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 701 | Rev 703 | ||
---|---|---|---|
Line 23... | Line 23... | ||
23 | volatile uint8_t messanzahl_AccHoch = 0; |
23 | volatile uint8_t messanzahl_AccHoch = 0; |
24 | volatile int32_t AirPressure = 32000; |
24 | volatile int32_t AirPressure = 32000; |
25 | volatile int16_t StartAirPressure; |
25 | volatile int16_t StartAirPressure; |
26 | volatile uint16_t ReadingAirPressure = 1023; |
26 | volatile uint16_t ReadingAirPressure = 1023; |
27 | uint8_t DruckOffsetSetting; |
27 | uint8_t DruckOffsetSetting; |
28 | volatile int16_t HoeheD = 0; |
28 | volatile int16_t HightD = 0; |
29 | volatile int16_t tmpAirPressure; |
29 | volatile int16_t tmpAirPressure; |
30 | volatile uint16_t ZaehlMessungen = 0; |
30 | volatile uint16_t ZaehlMessungen = 0; |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | /*****************************************************/ |
32 | /*****************************************************/ |
Line 85... | Line 85... | ||
85 | /*****************************************************/ |
85 | /*****************************************************/ |
86 | ISR(ADC_vect) |
86 | ISR(ADC_vect) |
87 | { |
87 | { |
88 | static uint8_t adc_channel = 0, state = 0; |
88 | static uint8_t adc_channel = 0, state = 0; |
89 | static uint16_t yaw1, roll1, pitch1; |
89 | static uint16_t yaw1, roll1, pitch1; |
90 | static uint8_t messanzahl_Druck = 0; |
90 | static uint8_t average_pressure = 0; |
91 | // disable further AD conversion |
91 | // disable further AD conversion |
92 | ADC_Disable(); |
92 | ADC_Disable(); |
93 | // state machine |
93 | // state machine |
94 | switch(state++) |
94 | switch(state++) |
95 | { |
95 | { |
Line 157... | Line 157... | ||
157 | Reading_Integral_Top -= Reading_Integral_Top / 1024; // dämfen |
157 | Reading_Integral_Top -= Reading_Integral_Top / 1024; // dämfen |
158 | adc_channel = 3; // set next channel to ADC3 = air pressure |
158 | adc_channel = 3; // set next channel to ADC3 = air pressure |
159 | break; |
159 | break; |
160 | case 10: |
160 | case 10: |
161 | tmpAirPressure += ADC; // sum vadc values |
161 | tmpAirPressure += ADC; // sum vadc values |
162 | if(++messanzahl_Druck >= 5) // if 5 values are summerized for averaging |
162 | if(++average_pressure >= 5) // if 5 values are summerized for averaging |
163 | { |
163 | { |
164 | ReadingAirPressure = ADC; // update measured air pressure |
164 | ReadingAirPressure = ADC; // update measured air pressure |
165 | messanzahl_Druck = 0; // reset air pressure measurement counter |
165 | average_pressure = 0; // reset air pressure measurement counter |
166 | HoeheD = (int16_t)(StartAirPressure - tmpAirPressure - ReadingHight); // D-Anteil = neuerWert - AlterWert |
166 | HightD = (int16_t)(StartAirPressure - tmpAirPressure - ReadingHight); // D-Anteil = neuerWert - AlterWert |
167 | AirPressure = (tmpAirPressure + 3 * AirPressure) / 4; // averaging using history |
167 | AirPressure = (tmpAirPressure + 3 * AirPressure) / 4; // averaging using history |
168 | ReadingHight = StartAirPressure - AirPressure; |
168 | ReadingHight = StartAirPressure - AirPressure; |
169 | tmpAirPressure = 0; |
169 | tmpAirPressure = 0; |
170 | } |
170 | } |
171 | adc_channel = 0; // set next channel to ADC0 = GIER GYRO |
171 | adc_channel = 0; // set next channel to ADC0 = GIER GYRO |