Rev 750 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 750 | Rev 761 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | volatile int16_t AdValueAccRoll = 0, AdValueAccPitch = 0, AdValueAccTop = 0; |
21 | volatile int16_t AdValueAccRoll = 0, AdValueAccPitch = 0, AdValueAccTop = 0; |
22 | volatile int32_t AirPressure = 32000; |
22 | volatile int32_t AirPressure = 32000; |
23 | volatile int16_t StartAirPressure; |
23 | volatile int16_t StartAirPressure; |
24 | volatile uint16_t ReadingAirPressure = 1023; |
24 | volatile uint16_t ReadingAirPressure = 1023; |
25 | uint8_t PressureSensorOffset; |
25 | uint8_t PressureSensorOffset; |
26 | volatile int16_t HightD = 0; |
26 | volatile int16_t HeightD = 0; |
27 | volatile uint16_t MeasurementCounter = 0; |
27 | volatile uint16_t MeasurementCounter = 0; |
Line 28... | Line 28... | ||
28 | 28 | ||
29 | /*****************************************************/ |
29 | /*****************************************************/ |
30 | /* Initialize Analog Digital Converter */ |
30 | /* Initialize Analog Digital Converter */ |
Line 169... | Line 169... | ||
169 | case 10: |
169 | case 10: |
170 | tmpAirPressure += ADC; // sum vadc values |
170 | tmpAirPressure += ADC; // sum vadc values |
171 | if(++average_pressure >= 5) // if 5 values are summerized for averaging |
171 | if(++average_pressure >= 5) // if 5 values are summerized for averaging |
172 | { |
172 | { |
173 | ReadingAirPressure = ADC; // update measured air pressure |
173 | ReadingAirPressure = ADC; // update measured air pressure |
174 | HightD = (int16_t)(StartAirPressure - tmpAirPressure - ReadingHight); // D-Anteil = neuerWert - AlterWert |
174 | HeightD = (int16_t)(StartAirPressure - tmpAirPressure - ReadingHeight); // D-Anteil = neuerWert - AlterWert |
175 | AirPressure = (tmpAirPressure + 3 * AirPressure) / 4; // averaging using history |
175 | AirPressure = (tmpAirPressure + 3 * AirPressure) / 4; // averaging using history |
176 | ReadingHight = StartAirPressure - AirPressure; |
176 | ReadingHeight = StartAirPressure - AirPressure; |
177 | average_pressure = 0; // reset air pressure measurement counter |
177 | average_pressure = 0; // reset air pressure measurement counter |
178 | tmpAirPressure = 0; |
178 | tmpAirPressure = 0; |
179 | } |
179 | } |
180 | adc_channel = 0; // set next channel to ADC0 = GIER GYRO |
180 | adc_channel = 0; // set next channel to ADC0 = GIER GYRO |
181 | state = 0; // reset state machine |
181 | state = 0; // reset state machine |