Subversion Repositories FlightCtrl

Rev

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

Rev 2012 Rev 2028
Line 170... Line 170...
170
volatile unsigned char FC_StatusFlags = 0, FC_StatusFlags2 = 0;
170
volatile unsigned char FC_StatusFlags = 0, FC_StatusFlags2 = 0;
171
long GIER_GRAD_FAKTOR = 1291;
171
long GIER_GRAD_FAKTOR = 1291;
172
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
172
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
173
signed int tmp_motorwert[MAX_MOTORS];
173
signed int tmp_motorwert[MAX_MOTORS];
174
char VarioCharacter = ' ';
174
char VarioCharacter = ' ';
-
 
175
unsigned int HooverGasEmergencyPercent = 0; // The gas value for Emergency landing
Line 175... Line 176...
175
 
176
 
176
#define LIMIT_MIN(value, min) {if(value <= min) value = min;}
177
#define LIMIT_MIN(value, min) {if(value <= min) value = min;}
177
#define LIMIT_MAX(value, max) {if(value >= max) value = max;}
178
#define LIMIT_MAX(value, max) {if(value >= max) value = max;}
Line 676... Line 677...
676
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
677
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
677
     static char NeueKompassRichtungMerken = 0;
678
     static char NeueKompassRichtungMerken = 0;
678
     static long ausgleichNick, ausgleichRoll;
679
     static long ausgleichNick, ausgleichRoll;
679
     int IntegralNickMalFaktor,IntegralRollMalFaktor;
680
     int IntegralNickMalFaktor,IntegralRollMalFaktor;
680
         unsigned char i;
681
         unsigned char i;
681
         unsigned int HooverGas80Percent;
-
 
682
        Mittelwert();
682
        Mittelwert();
683
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
683
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
684
// Gaswert ermitteln
684
// Gaswert ermitteln
685
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
685
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
686
        if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)
-
 
687
        {
-
 
688
     if(HoverGas && HoverGas < 150 * STICK_GAIN)
-
 
689
           {
686
        HooverGas80Percent = HoverGas/(STICK_GAIN + STICK_GAIN/4); // 80% of Hovergas
690
                HooverGasEmergencyPercent = (HoverGas/(STICK_GAIN) * EE_Parameter.NotGas) / 100; // i.e. 80% of Hovergas
-
 
691
           }
-
 
692
      else HooverGasEmergencyPercent = 45;  // default if the Hoovergas was could not calculated yet
-
 
693
    } else HooverGasEmergencyPercent = EE_Parameter.NotGas;
-
 
694
 
687
        GasMischanteil = StickGas;
695
        GasMischanteil = StickGas;
688
    if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
696
    if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
689
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
697
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
690
// Empfang schlecht
698
// Empfang schlecht
691
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
699
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 699... Line 707...
699
          FC_StatusFlags &= ~(FC_STATUS_EMERGENCY_LANDING | FC_STATUS_FLY);
707
          FC_StatusFlags &= ~(FC_STATUS_EMERGENCY_LANDING | FC_STATUS_FLY);
700
         }
708
         }
701
        ROT_ON;
709
        ROT_ON;
702
        if(modell_fliegt > 1000 && Capacity.MinOfMaxPWM > 100)  // wahrscheinlich in der Luft --> langsam absenken
710
        if(modell_fliegt > 1000 && Capacity.MinOfMaxPWM > 100)  // wahrscheinlich in der Luft --> langsam absenken
703
            {
711
            {
704
            GasMischanteil = EE_Parameter.NotGas;
712
            GasMischanteil = HooverGasEmergencyPercent;
705
                        if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)
-
 
706
                         {
-
 
707
                          if(HoverGas && HoverGas < 150 * STICK_GAIN)   GasMischanteil = HooverGas80Percent; // 80% of Hovergas
-
 
708
                         }
-
 
709
            FC_StatusFlags |= FC_STATUS_EMERGENCY_LANDING;
713
            FC_StatusFlags |= FC_STATUS_EMERGENCY_LANDING;
710
            PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
714
            PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
711
            PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
715
            PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
712
            PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
716
            PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0;
713
            PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
717
            PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0;
Line 1733... Line 1737...
1733
        {
1737
        {
1734
                // set undefined state to indicate vario off
1738
                // set undefined state to indicate vario off
1735
                FC_StatusFlags |= (FC_STATUS_VARIO_TRIM_UP|FC_STATUS_VARIO_TRIM_DOWN);
1739
                FC_StatusFlags |= (FC_STATUS_VARIO_TRIM_UP|FC_STATUS_VARIO_TRIM_DOWN);
1736
        } // EOF no height control
1740
        } // EOF no height control
Line 1737... Line 1741...
1737
 
1741
 
1738
    // limit gas to parameter setting
1742
   // Linits the maximum gas in case of "Out of Range emergency landing"
1739
   if(NC_To_FC_Flags & NC_TO_FC_EMERGENCY_LANDING)
1743
   if(NC_To_FC_Flags & NC_TO_FC_EMERGENCY_LANDING)
1740
        {
1744
        {
1741
         if(GasMischanteil/STICK_GAIN > HooverGas80Percent && HoverGas) GasMischanteil = HooverGas80Percent * STICK_GAIN;
1745
         if(GasMischanteil/STICK_GAIN > HooverGasEmergencyPercent && HoverGas) GasMischanteil = HooverGasEmergencyPercent * STICK_GAIN;
1742
          beeptime = 15000;
1746
          beeptime = 15000;
1743
          BeepMuster = 0x0E00;
1747
          BeepMuster = 0x0E00;
-
 
1748
        }
1744
        }
1749
    // limit gas to parameter setting
1745
  LIMIT_MIN(GasMischanteil, (MIN_GAS + 10) * STICK_GAIN);
1750
  LIMIT_MIN(GasMischanteil, (MIN_GAS + 10) * STICK_GAIN);
Line 1746... Line 1751...
1746
  if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN;
1751
  if(GasMischanteil > (MAX_GAS - 20) * STICK_GAIN) GasMischanteil = (MAX_GAS - 20) * STICK_GAIN;
1747
 
1752