Rev 1638 | Rev 1643 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1638 | Rev 1639 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | ready = 0; |
71 | ready = 0; |
72 | if(AdWertNick < 1020) AnalogOffsetNick--; else if(AdWertNick > 1030) AnalogOffsetNick++; else ready++; |
72 | if(AdWertNick < 1020) AnalogOffsetNick--; else if(AdWertNick > 1030) AnalogOffsetNick++; else ready++; |
73 | if(AdWertRoll < 1020) AnalogOffsetRoll--; else if(AdWertRoll > 1030) AnalogOffsetRoll++; else ready++; |
73 | if(AdWertRoll < 1020) AnalogOffsetRoll--; else if(AdWertRoll > 1030) AnalogOffsetRoll++; else ready++; |
74 | if(AdWertGier < 1020) AnalogOffsetGier--; else if(AdWertGier > 1030) AnalogOffsetGier++; else ready++; |
74 | if(AdWertGier < 1020) AnalogOffsetGier--; else if(AdWertGier > 1030) AnalogOffsetGier++; else ready++; |
75 | twi_state = 18; |
75 | twi_state = 18; |
76 | i2c_start(); |
76 | I2C_Start(); |
77 | if(AnalogOffsetNick < 10) { GyroDefektN = 1; AnalogOffsetNick = 10;}; if(AnalogOffsetNick > 245) { GyroDefektN = 1; AnalogOffsetNick = 245;}; |
77 | if(AnalogOffsetNick < 10) { GyroDefektN = 1; AnalogOffsetNick = 10;}; if(AnalogOffsetNick > 245) { GyroDefektN = 1; AnalogOffsetNick = 245;}; |
78 | if(AnalogOffsetRoll < 10) { GyroDefektR = 1; AnalogOffsetRoll = 10;}; if(AnalogOffsetRoll > 245) { GyroDefektR = 1; AnalogOffsetRoll = 245;}; |
78 | if(AnalogOffsetRoll < 10) { GyroDefektR = 1; AnalogOffsetRoll = 10;}; if(AnalogOffsetRoll > 245) { GyroDefektR = 1; AnalogOffsetRoll = 245;}; |
79 | if(AnalogOffsetGier < 10) { GyroDefektG = 1; AnalogOffsetGier = 10;}; if(AnalogOffsetGier > 245) { GyroDefektG = 1; AnalogOffsetGier = 245;}; |
79 | if(AnalogOffsetGier < 10) { GyroDefektG = 1; AnalogOffsetGier = 10;}; if(AnalogOffsetGier > 245) { GyroDefektG = 1; AnalogOffsetGier = 245;}; |
80 | while(twi_state) if(CheckDelay(timeout)) {printf("\n\r DAC or I2C ERROR! Check I2C, 3Vref, DAC and BL-Ctrl"); break;} |
80 | while(twi_state) if(CheckDelay(timeout)) {printf("\n\r DAC or I2C ERROR! Check I2C, 3Vref, DAC and BL-Ctrl"); break;} |
81 | AdReady = 0; |
81 | AdReady = 0; |
Line 112... | Line 112... | ||
112 | ISR(ADC_vect) |
112 | ISR(ADC_vect) |
113 | //####################################################################################### |
113 | //####################################################################################### |
114 | { |
114 | { |
115 | static unsigned char kanal=0,state = 0; |
115 | static unsigned char kanal=0,state = 0; |
116 | static signed int gier1, roll1, nick1, nick_filter, roll_filter; |
116 | static signed int gier1, roll1, nick1, nick_filter, roll_filter; |
117 | static signed int accy, accx; |
117 | static signed int accy, accx,subcount = 0; |
Line 118... | Line 118... | ||
118 | 118 | ||
119 | static long tmpLuftdruck = 0; |
119 | static long tmpLuftdruck = 0; |
120 | static char messanzahl_Druck = 0; |
120 | static char messanzahl_Druck = 0; |
121 | switch(state++) |
121 | switch(state++) |
Line 158... | Line 158... | ||
158 | AdWertAccHoch = (signed int) ADC - NeutralAccZ; |
158 | AdWertAccHoch = (signed int) ADC - NeutralAccZ; |
159 | if(AdWertAccHoch > 1) |
159 | if(AdWertAccHoch > 1) |
160 | { |
160 | { |
161 | if(NeutralAccZ < 750) |
161 | if(NeutralAccZ < 750) |
162 | { |
162 | { |
- | 163 | subcount += 2; |
|
- | 164 | if(modell_fliegt < 500) subcount += 100; |
|
- | 165 | } |
|
- | 166 | if(subcount > 1000) { NeutralAccZ++; subcount -= 1000;} |
|
- | 167 | } |
|
- | 168 | else if(AdWertAccHoch < -1) |
|
- | 169 | { |
|
- | 170 | if(NeutralAccZ > 550) |
|
- | 171 | { |
|
- | 172 | subcount -= 2; |
|
- | 173 | if(modell_fliegt < 500) subcount -= 100; |
|
- | 174 | if(subcount < -1000) { NeutralAccZ--; subcount += 1000;} |
|
- | 175 | } |
|
- | 176 | } |
|
- | 177 | messanzahl_AccHoch = 1; |
|
- | 178 | Aktuell_az = ADC; |
|
- | 179 | Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
|
- | 180 | Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
|
- | 181 | ||
- | 182 | /* |
|
- | 183 | AdWertAccHoch = (signed int) ADC - NeutralAccZ; |
|
- | 184 | if(AdWertAccHoch > 1) |
|
- | 185 | { |
|
- | 186 | if(NeutralAccZ < 750) |
|
- | 187 | { |
|
163 | NeutralAccZ += 0.02; |
188 | NeutralAccZ += 0.02; |
164 | if(modell_fliegt < 500) NeutralAccZ += 0.1; |
189 | if(modell_fliegt < 500) NeutralAccZ += 0.1; |
165 | } |
190 | } |
166 | } |
191 | } |
167 | else if(AdWertAccHoch < -1) |
192 | else if(AdWertAccHoch < -1) |
Line 174... | Line 199... | ||
174 | } |
199 | } |
175 | messanzahl_AccHoch = 1; |
200 | messanzahl_AccHoch = 1; |
176 | Aktuell_az = ADC; |
201 | Aktuell_az = ADC; |
177 | Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
202 | Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
178 | Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
203 | Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
- | 204 | */ |
|
179 | kanal = AD_DRUCK; |
205 | kanal = AD_DRUCK; |
180 | break; |
206 | break; |
181 | // "case 8:" fehlt hier absichtlich |
207 | // "case 8:" fehlt hier absichtlich |
182 | case 10: |
208 | case 10: |
183 | nick1 += ADC; |
209 | nick1 += ADC; |