Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2293 → Rev 2294

/test_branches/FC2_2/analog.c
192,8 → 192,7
static signed int gier1, roll1, nick1, nick_filter, roll_filter;
static signed int accy, accx;
static long tmpLuftdruck = 0;
static long result[16];
static unsigned char messanzahl_Druck = 0;
// static char messanzahl_Druck = 0;
#define ANZ_RING 32
//static long VarioRing[ANZ_RING];
//static unsigned char RingPtr = 0;
246,9 → 245,6
//else Aktuell_az = 1024 - ADC;
// tmp = (signed int) Aktuell_az - NeutralAccZ;
AdWertAccHoch = Aktuell_az - NeutralAccZ;
// AccZSum = AccZSum - AdWertAccHoch + Aktuell_az - NeutralAccZ;
// AdWertAccHoch = AccZSum/32;
// AdWertAccHoch = (7 * AdWertAccHoch + tmp) / 8;
}
if(PlatinenVersion < 22)
{
326,7 → 322,6
// - neu -------------------------------------------------
case 17:
HoehenDiff = HoehenWert - HoeheAlt;
// vvSum = vvSum - vv + ((Aktuell_az - NeutralAccZ) - AccShorter)*7 + HoehenDiff*500; // Fusion vert. velocity
AccVertical = (long)(AdWertAccHoch + 172)*CosAttitude/8192 - 172;
vvSum = vvSum - vv + AccVertical*13 + HoehenDiff*500; // Fusion vert. velocity, T=2s
vv = (vvSum + 512)/1024; // cm/s
333,8 → 328,7
HoeheAlt = HoehenWert;
SummenHoehe = SummenHoehe - HoehenWertF + vv + HoehenWert; //Fusion Hoehe
HoehenWertF = (SummenHoehe + SM_FILTER/2)/SM_FILTER; // cm
//DebugOut.Analog[19] = AdWertAccHoch*7;
//DebugOut.Analog[16] = ((Aktuell_az - NeutralAccZ) - AccShorter);
 
state = 0;
AdReady = 1;
ZaehlMessungen++;
341,17 → 335,12
// "break" fehlt hier absichtlich
case 9:
MessLuftdruck = ADC;
result[messanzahl_Druck] = MessLuftdruck - 523 * (long)ExpandBaro; // -523 counts per offset step
messanzahl_Druck = (messanzahl_Druck + 1)&(15);
tmpLuftdruck = 0;
for(int j=0;j<16;j++) {tmpLuftdruck+=result[j];}
// Luftdruck = tmpLuftdruck;
Luftdruck = (15 * Luftdruck + tmpLuftdruck) / 16; // noise reduction
HoehenWert = StartLuftdruck - Luftdruck;
tmpLuftdruck = MessLuftdruck - 523 * (long)ExpandBaro; // -523 counts per offset step
Luftdruck -= Luftdruck/16;
Luftdruck += tmpLuftdruck;
HoehenWert = StartLuftdruck - Luftdruck; // cm
if(PlatinenVersion > 21) HoehenWert = HoehenWert + AdWertAccHoch*41/256;
// if (messanzahl_Druck == 0) OCR0A++; // generates sawtooth
// if (messanzahl_Druck == 1) OCR0A--;
// if(PlatinenVersion > 21) HoehenWert = HoehenWert*5/16 + AdWertAccHoch*41/256; //+ compensates disturbance due to acceleration
/* // Qopter: deaktivieren Anfang
if(PlatinenVersion > 21 && NeutralAccZ) MessLuftdruck -= (Aktuell_az - NeutralAccZ)/12;
tmpLuftdruck += MessLuftdruck;
/test_branches/FC2_2/fc.c
204,7 → 204,6
DebugOut.Analog[16] = Variance;
DebugOut.Analog[17] = vv;
DebugOut.Analog[18] = HoehenWertF;
DebugOut.Analog[19] = Parameter_UserParam1;
DebugOut.Analog[20] = ServoNickValue;
DebugOut.Analog[22] = Capacity.ActualCurrent;
DebugOut.Analog[23] = Capacity.UsedCapacity;
1703,7 → 1702,6
else // valid data from air pressure sensor
{
// ------------------------- P-Part ----------------------------
//J17_ON; //Qopter: testweise zur Rechenzeitmessung
tmp_long = (HoehenWertF - SollHoehe); // positive when too high
LIMIT_MIN_MAX(tmp_long, -32767L, 32767L); // avoid overflov when casting to int16_t
HeightDeviation = (int)(tmp_long); // positive when too high
1725,7 → 1723,6
HCGas -= GasReduction;
LIMIT_MIN_MAX(HCGas, HoverGasMin, HoverGasMax); // limits gas around hover point
//J17_OFF;
/* Qopter: deaktiviert
// ------------------------- D-Part 1: Vario Meter ----------------------------
1829,11 → 1826,6
{ // reduce the time constant of averaging by factor of 4 to get much faster a stable value
HoverGasFilter -= HoverGasFilter/(HOVER_GAS_AVERAGE/16L);
HoverGasFilter += 16L * tmp_long2;
if(Parameter_UserParam1 > 50)
{
SummeNick = 0; // avoids wind up at take off
SummeRoll = 0; // avoids wind up at take off
}
}
if(modell_fliegt < 8000) // the first 16 seconds
{ // reduce the time constant of averaging by factor of 2 to get much faster a stable value
/test_branches/FC2_2/main.c
422,7 → 422,7
timer = SetDelay(20); // falls "timer += 20;" mal nicht geht
}
}
// LED_Update(); //Qopter: Zur Rechenzeitmessung testweise abgeschaltet
LED_Update();
Capacity_Update();
} //else DebugOut.Analog[26]++;
}