Rev 1021 | Rev 1111 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1021 | Rev 1036 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | volatile char messanzahl_AccNick = 0, messanzahl_AccRoll = 0, messanzahl_AccHoch = 0; |
14 | volatile char messanzahl_AccNick = 0, messanzahl_AccRoll = 0, messanzahl_AccHoch = 0; |
15 | volatile long Luftdruck = 32000; |
15 | volatile long Luftdruck = 32000; |
16 | volatile int StartLuftdruck; |
16 | volatile int StartLuftdruck; |
17 | volatile unsigned int MessLuftdruck = 1023; |
17 | volatile unsigned int MessLuftdruck = 1023; |
18 | unsigned char DruckOffsetSetting; |
18 | unsigned char DruckOffsetSetting; |
- | 19 | signed char ExpandBaro = 0; |
|
19 | volatile int HoeheD = 0; |
20 | volatile int HoeheD = 0; |
20 | volatile char messanzahl_Druck; |
21 | volatile char messanzahl_Druck; |
21 | volatile int tmpLuftdruck; |
22 | volatile int tmpLuftdruck; |
22 | volatile unsigned int ZaehlMessungen = 0; |
23 | volatile unsigned int ZaehlMessungen = 0; |
23 | unsigned char AnalogOffsetNick = 115,AnalogOffsetRoll = 115,AnalogOffsetGier = 115; |
24 | unsigned char AnalogOffsetNick = 115,AnalogOffsetRoll = 115,AnalogOffsetGier = 115; |
Line 36... | Line 37... | ||
36 | { |
37 | { |
37 | unsigned int off; |
38 | unsigned int off; |
38 | off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]); |
39 | off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]); |
39 | if(off > 20) off -= 10; |
40 | if(off > 20) off -= 10; |
40 | OCR0A = off; |
41 | OCR0A = off; |
- | 42 | ExpandBaro = 0; |
|
41 | Delay_ms_Mess(100); |
43 | Delay_ms_Mess(100); |
42 | if(MessLuftdruck < 850) off = 0; |
44 | if(MessLuftdruck < 850) off = 0; |
43 | for(; off < 250;off++) |
45 | for(; off < 250;off++) |
44 | { |
46 | { |
45 | OCR0A = off; |
47 | OCR0A = off; |
46 | Delay_ms_Mess(50); |
48 | Delay_ms_Mess(50); |
47 | printf("."); |
49 | printf("."); |
48 | if(MessLuftdruck < 900) break; |
50 | if(MessLuftdruck < 850) break; |
49 | } |
51 | } |
50 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off); |
52 | eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off); |
51 | DruckOffsetSetting = off; |
53 | DruckOffsetSetting = off; |
52 | Delay_ms_Mess(300); |
54 | Delay_ms_Mess(300); |
53 | } |
55 | } |
Line 163... | Line 165... | ||
163 | tmpLuftdruck += ADC; |
165 | tmpLuftdruck += ADC; |
164 | if(++messanzahl_Druck >= 5) |
166 | if(++messanzahl_Druck >= 5) |
165 | { |
167 | { |
166 | MessLuftdruck = ADC; |
168 | MessLuftdruck = ADC; |
167 | messanzahl_Druck = 0; |
169 | messanzahl_Druck = 0; |
168 | HoeheD = (7 * HoeheD + (int) Parameter_Luftdruck_D * (int)(StartLuftdruck - tmpLuftdruck - HoehenWert))/8; // D-Anteil = neuerWert - AlterWert |
170 | HoeheD = (7 * HoeheD + (int) Parameter_Luftdruck_D * (int)(255 * ExpandBaro + StartLuftdruck - tmpLuftdruck - HoehenWert))/8; // D-Anteil = neuerWert - AlterWert |
169 | Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4; |
171 | Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4; |
170 | HoehenWert = StartLuftdruck - Luftdruck; |
172 | HoehenWert = 255 * ExpandBaro + StartLuftdruck - Luftdruck; |
171 | tmpLuftdruck = 0; |
173 | tmpLuftdruck = 0; |
172 | } |
174 | } |
173 | kanal = 0; |
175 | kanal = 0; |
174 | state = 0; |
176 | state = 0; |
175 | break; |
177 | break; |