Subversion Repositories FlightCtrl

Rev

Rev 2471 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2471 Rev 2497
Line 120... Line 120...
120
 
120
 
121
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
121
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
122
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
122
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
123
// + correction of the altitude error in higher altitudes
123
// + correction of the altitude error in higher altitudes
124
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
124
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
125
 CalAthmospheare = 16;
125
 CalAthmospheare = 15;                                      // re-claibrated from 16 to 15 at 2.09 -> the baro-Altimeter was about 7% too high
126
 if(ACC_AltitudeControl)
126
 if(ACC_AltitudeControl)
127
  {
127
  {
128
   if(PlatinenVersion < 23) { if(off < 140) CalAthmospheare += (160 - off) / 26; }
128
   if(PlatinenVersion < 23) { if(off < 140) CalAthmospheare += (160 - off) / 26; }
-
 
129
//   else { if(off < 170) CalAthmospheare += (188 - off) / 19; }
129
   else { if(off < 170) CalAthmospheare += (188 - off) / 19; }
130
   else { if(off < 170) CalAthmospheare += (188 - off) / 15; } // rescaled at 2.09
130
  }
131
  }
131
 Luftdruck = MessLuftdruck * CalAthmospheare;
132
 Luftdruck = MessLuftdruck * CalAthmospheare;
132
#endif
133
#endif
133
 Delay_ms_Mess(300);
134
 Delay_ms_Mess(300);
Line 351... Line 352...
351
        case 9:
352
        case 9:
352
                MessLuftdruck = ADC;
353
                MessLuftdruck = ADC;
353
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
354
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
354
                        if(ACC_AltitudeControl)                
355
                        if(ACC_AltitudeControl)                
355
                        {
356
                        {
356
//                              ExpandBaroStep = BaroStep * (long)ExpandBaro; // wird in fc.c aufgerufen
-
 
357
//                              tmpLuftdruck = MessLuftdruck - BaroStep * (long)ExpandBaro;  // -523 counts per offset step
-
 
358
                                tmpLuftdruck = MessLuftdruck - ExpandBaroStep;  // -523 counts per offset step
357
                                tmpLuftdruck = MessLuftdruck - ExpandBaroStep;  // -523 counts per offset step
-
 
358
                                if(BaroExpandActive)
-
 
359
                                {
-
 
360
                                  if(BaroExpandActive < 10) Luftdruck = tmpLuftdruck * CalAthmospheare;
-
 
361
                                }
-
 
362
                                else
-
 
363
                                {
359
                                Luftdruck -= Luftdruck / CalAthmospheare; // 16
364
                                        Luftdruck -= Luftdruck / CalAthmospheare; // 16
360
                                Luftdruck += tmpLuftdruck;
365
                                        Luftdruck += tmpLuftdruck;
361
                                HoehenWert_Mess = StartLuftdruck - Luftdruck;   // cm
366
                                        HoehenWert_Mess = StartLuftdruck - Luftdruck;   // cm
-
 
367
                                }                      
362
                        }
368
                        }
363
                        else
369
                        else
364
#endif
370
#endif
365
            {   // old version (until FC V2.1)
371
            {   // old version (until FC V2.1)
366
                                tmpLuftdruck += MessLuftdruck;
372
                                tmpLuftdruck += MessLuftdruck;
367
                                if(++messanzahl_Druck >= 16) // war bis 0.86 "18"
373
                                if(++messanzahl_Druck >= 16) // war bis 0.86 "18"
368
                                {
374
                                {
369
                            signed int tmp;
375
                            signed int tmp;
370
//                              Luftdruck = (7 * Luftdruck + tmpLuftdruck - (16 * BaroStep) * (long)ExpandBaro + 4) / 8;  // -523.19 counts per 10 counts offset step
-
 
371
//                              ExpandBaroStep = (16 * BaroStep) * (long)ExpandBaro - 4; // wird in fc.c aufgerufen
-
 
372
                                Luftdruck = (7 * Luftdruck + tmpLuftdruck - ExpandBaroStep) / 8;  // -523.19 counts per 10 counts offset step
376
                                Luftdruck = (7 * Luftdruck + tmpLuftdruck - ExpandBaroStep) / 8;  // -523.19 counts per 10 counts offset step
373
                                HoehenWert_Mess = StartLuftdruck - Luftdruck;
377
                                HoehenWert_Mess = StartLuftdruck - Luftdruck;
374
                                SummenHoehe -= SummenHoehe/SM_FILTER;
378
                                SummenHoehe -= SummenHoehe/SM_FILTER;
375
                                SummenHoehe += HoehenWert_Mess;
379
                                SummenHoehe += HoehenWert_Mess;
376
                                tmp = (HoehenWert_Mess - SummenHoehe/SM_FILTER);
380
                                tmp = (HoehenWert_Mess - SummenHoehe/SM_FILTER);