Subversion Repositories FlightCtrl

Rev

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

Rev 1639 Rev 1642
Line 271... Line 271...
271
    Parameter_AchsKopplung1 = 0;
271
    Parameter_AchsKopplung1 = 0;
272
    Parameter_AchsKopplung2 = 0;
272
    Parameter_AchsKopplung2 = 0;
Line 273... Line 273...
273
 
273
 
Line 274... Line 274...
274
    ExpandBaro = 0;
274
    ExpandBaro = 0;
275
 
275
 
Line 276... Line 276...
276
    TransmitBlConfig = 1;
276
    TransmitBlConfig = 1;
277
        motorread = 0;
277
        motorread = 0;
Line 627... Line 627...
627
     static long IntegralFehlerRoll = 0;
627
     static long IntegralFehlerRoll = 0;
628
         static unsigned int RcLostTimer;
628
         static unsigned int RcLostTimer;
629
         static unsigned char delay_neutral = 0;
629
         static unsigned char delay_neutral = 0;
630
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
630
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
631
         static unsigned char calibration_done = 0;
631
         static unsigned char calibration_done = 0;
632
     static char TimerWerteausgabe = 0;
-
 
633
     static char NeueKompassRichtungMerken = 0;
632
     static char NeueKompassRichtungMerken = 0;
634
     static long ausgleichNick, ausgleichRoll;
633
     static long ausgleichNick, ausgleichRoll;
635
     int IntegralNickMalFaktor,IntegralRollMalFaktor;
634
     int IntegralNickMalFaktor,IntegralRollMalFaktor;
636
         unsigned char i;
635
         unsigned char i;
637
        Mittelwert();
636
        Mittelwert();
Line 1273... Line 1272...
1273
                #define HOVER_GAS_AVERAGE 4096L         // 4096 * 2ms = 8.2s averaging
1272
                #define HOVER_GAS_AVERAGE 4096L         // 4096 * 2ms = 8.2s averaging
1274
                #define HC_GAS_AVERAGE 4                        // 4 * 2ms= 8ms averaging
1273
                #define HC_GAS_AVERAGE 4                        // 4 * 2ms= 8ms averaging
Line 1275... Line 1274...
1275
 
1274
 
1276
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
1275
#if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
1277
#define OPA_OFFSET_STEP 15
1276
#define OPA_OFFSET_STEP 15
1278
#else 
1277
#else
1279
#define OPA_OFFSET_STEP 10
1278
#define OPA_OFFSET_STEP 10
1280
#endif
1279
#endif
1281
                int HCGas, HeightDeviation = 0;
1280
                int HCGas, HeightDeviation = 0;
1282
                static int HeightTrimming = 0;  // rate for change of height setpoint
1281
                static int HeightTrimming = 0;  // rate for change of height setpoint
Line 1286... Line 1285...
1286
                static unsigned char delay = 100, BaroAtUpperLimit = 0, BaroAtLowerLimit = 0;
1285
                static unsigned char delay = 100, BaroAtUpperLimit = 0, BaroAtLowerLimit = 0;
1287
            int CosAttitude;    // for projection of hoover gas
1286
            int CosAttitude;    // for projection of hoover gas
Line 1288... Line 1287...
1288
 
1287
 
1289
                // get the current hooverpoint
1288
                // get the current hooverpoint
1290
                DebugOut.Analog[21] = HoverGas;
1289
                DebugOut.Analog[21] = HoverGas;
1291
               
1290
 
1292
        // Expand the measurement
1291
        // Expand the measurement
1293
                // measurement of air pressure close to upper limit and no overflow in correction of the new OCR0A value occurs
1292
                // measurement of air pressure close to upper limit and no overflow in correction of the new OCR0A value occurs
1294
          if(!BaroExpandActive)
1293
          if(!BaroExpandActive)
1295
                   {
1294
                   {
Line 1639... Line 1638...
1639
    if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int;
1638
    if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int;
Line 1640... Line 1639...
1640
 
1639
 
1641
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1640
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1642
// Universal Mixer
1641
// Universal Mixer
1643
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1642
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1644
 for(i=0; i<MAX_MOTORS; i++)
1643
        for(i=0; i<MAX_MOTORS; i++)
1645
 {
1644
        {
1646
  signed int tmp_int;
1645
                signed int tmp_int;
1647
  if(Mixer.Motor[i][0] > 0)
1646
                if(Mixer.Motor[i][0] > 0)
1648
   {
1647
                {
1649
    tmp_int =  ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L;
1648
                        tmp_int =  ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L;
1650
    tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L;
1649
                        tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L;
1651
    tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1650
                        tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L;
1652
    tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1651
                        tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
1653
    tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]);  // Filter
1652
                        tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]);  // Filter
1654
        tmp_int = tmp_motorwert[i] / 4;
1653
                        tmp_int = tmp_motorwert[i] / 4;
1655
        Motor[i].SetPointLowerBits = tmp_motorwert[i] % 4;
1654
                        Motor[i].SetPointLowerBits = tmp_motorwert[i] % 4;
1656
        LIMIT_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
1655
                        LIMIT_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS);
1657
    Motor[i].SetPoint = tmp_int;
1656
                        Motor[i].SetPoint = tmp_int;
-
 
1657
                }
-
 
1658
                else
1658
   }
1659
                {
-
 
1660
                        Motor[i].SetPoint = 0;
-
 
1661
                        Motor[i].SetPointLowerBits = 0;
1659
   else Motor[i].SetPoint = 0;
1662
                }
1660
 }
1663
        }