Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2753 → Rev 2754

/trunk/analog.c
76,7 → 76,7
long HoehenWert_Mess = 0;
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
long HoehenWertF_Mess = 0;
unsigned char CalAthmospheare = 16;
unsigned char CalAthmospheare = 16*8;
unsigned char AD_ACC_Y = 6;
unsigned char AD_ACC_X = 7;
#endif
91,10 → 91,25
 
#define DESIRED_H_ADC 800
 
void CalcCalAthmospheare(int off)
{
// re-claibrated from 16 to 15 at 2.09 -> the baro-Altimeter was about 7% too high
CalAthmospheare = 124; //15*8;
if(ACC_AltitudeControl)
{
if(PlatinenVersion < 23) { if(off < 140) CalAthmospheare += (8*(160 - off)) / 26; }
// else { if(off < 170) CalAthmospheare += (188 - off) / 19; }
// else { if(off < 188) CalAthmospheare += (8*(188 - off)) / 15; } // rescaled at 2.09
else { if(off < 188) CalAthmospheare += (8*(188 - off)) / 21; } // rescaled at 2.21
}
}
 
 
void CalcExpandBaroStep(void)
{
if(ACC_AltitudeControl) ExpandBaroStep = BaroStep * (long)ExpandBaro;
else ExpandBaroStep = (16 * BaroStep) * (long)ExpandBaro - 4;
//if(PlatinenVersion >= 23) CalcCalAthmospheare(OCR0A); //--> noch nicht im Flug getestet
}
 
void SucheLuftruckOffset(void)
124,14 → 139,9
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// + correction of the altitude error in higher altitudes
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CalAthmospheare = 15; // re-claibrated from 16 to 15 at 2.09 -> the baro-Altimeter was about 7% too high
if(ACC_AltitudeControl)
{
if(PlatinenVersion < 23) { if(off < 140) CalAthmospheare += (160 - off) / 26; }
// else { if(off < 170) CalAthmospheare += (188 - off) / 19; }
else { if(off < 170) CalAthmospheare += (188 - off) / 15; } // rescaled at 2.09
}
Luftdruck = MessLuftdruck * CalAthmospheare;
CalcCalAthmospheare(off);
 
Luftdruck = (MessLuftdruck * CalAthmospheare)/8;
LuftdruckKompensiert = Luftdruck + LuftdruckTemperaturOffset;
#endif
Delay_ms_Mess(300);
360,11 → 370,11
tmpLuftdruck = MessLuftdruck - ExpandBaroStep; // -523 counts per offset step
if(BaroExpandActive)
{
if(BaroExpandActive < 10) Luftdruck = tmpLuftdruck * CalAthmospheare;
if(BaroExpandActive < 10) Luftdruck = (tmpLuftdruck * CalAthmospheare)/8;
}
else
{
Luftdruck -= Luftdruck / CalAthmospheare; // 16
Luftdruck -= (8*Luftdruck) / CalAthmospheare; // 16
Luftdruck += tmpLuftdruck;
LuftdruckKompensiert = Luftdruck + LuftdruckTemperaturOffset;
HoehenWert_Mess = StartLuftdruck - LuftdruckKompensiert; // cm