Subversion Repositories FlightCtrl

Rev

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

Rev 2191 Rev 2230
Line 173... Line 173...
173
long GIER_GRAD_FAKTOR = 1291;
173
long GIER_GRAD_FAKTOR = 1291;
174
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
174
signed int KopplungsteilNickRoll,KopplungsteilRollNick;
175
signed int tmp_motorwert[MAX_MOTORS];
175
signed int tmp_motorwert[MAX_MOTORS];
176
char VarioCharacter = ' ';
176
char VarioCharacter = ' ';
177
unsigned int HooverGasEmergencyPercent = 0; // The gas value for Emergency landing
177
unsigned int HooverGasEmergencyPercent = 0; // The gas value for Emergency landing
178
 
-
 
-
 
178
unsigned int GasIsZeroCnt = 0; // to detect that the gas-stick is down for a while
Line 179... Line 179...
179
 
179
 
180
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
180
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
181
//  Debugwerte zuordnen
181
//  Debugwerte zuordnen
182
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
182
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 688... Line 688...
688
         unsigned char i;
688
         unsigned char i;
689
        Mittelwert();
689
        Mittelwert();
690
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
690
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
691
// Gaswert ermitteln
691
// Gaswert ermitteln
692
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
692
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
693
  if(!(FC_StatusFlags & (FC_STATUS_EMERGENCY_LANDING | FC_STATUS2_RC_FAILSAVE_ACTIVE)))
-
 
694
   {
693
        if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)
695
        if(EE_Parameter.GlobalConfig3 & CFG3_VARIO_FAILSAFE)
694
        {
696
        {
695
     if(HoverGas && HoverGas < 150 * STICK_GAIN)
697
     if(HoverGas && HoverGas < 150 * STICK_GAIN)
696
           {
698
           {
697
                HooverGasEmergencyPercent = (HoverGas/(STICK_GAIN) * EE_Parameter.NotGas) / 100; // i.e. 80% of Hovergas
699
                HooverGasEmergencyPercent = (HoverGas/(STICK_GAIN) * EE_Parameter.NotGas) / 100; // i.e. 80% of Hovergas
698
           }
700
           }
699
      else HooverGasEmergencyPercent = 45;  // default if the Hoovergas was could not calculated yet
701
      else HooverGasEmergencyPercent = 45;  // default if the Hoovergas was could not calculated yet
700
    } else HooverGasEmergencyPercent = EE_Parameter.NotGas;
702
    } else HooverGasEmergencyPercent = EE_Parameter.NotGas;
-
 
703
   }
-
 
704
   if(GasIsZeroCnt == 30000)  // in that case we have RC-Lost, but the MK is probably landed
-
 
705
    {
-
 
706
         StickGas = 0; // Hold Gas down in that case 
-
 
707
         HooverGasEmergencyPercent = MIN_GAS;
701
 
708
        }
702
        GasMischanteil = StickGas;
709
        GasMischanteil = StickGas;
703
    if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
710
    if(GasMischanteil < MIN_GAS + 10) GasMischanteil = MIN_GAS + 10;
704
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
711
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
705
// Empfang schlecht
712
// Empfang schlecht
706
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
713
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 882... Line 889...
882
#endif
889
#endif
883
                                                        }
890
                                                        }
884
                                                }
891
                                                }
885
                                                else delay_ausschalten = 0;
892
                                                else delay_ausschalten = 0;
886
                                        }
893
                                        }
887
                }
894
                  if(GasIsZeroCnt < 1000) GasIsZeroCnt++;
-
 
895
                                }
888
                                else // gas not at minimum
896
                                else // gas not at minimum
-
 
897
                                {
889
                                move_safety_switch = 0;
898
                                  move_safety_switch = 0;
-
 
899
                                  GasIsZeroCnt = 0;
-
 
900
                                }  
890
            }
901
            }
-
 
902
                        else  // Empfang zwischen 100 und 140 -> schlecht
-
 
903
                        {
-
 
904
                        if(GasIsZeroCnt >= 750)  // gas-stick was down for 1.5 seconds before RC-Lost
-
 
905
                         {
-
 
906
                           if((GPSInfo.HomeDistance < 40 * 10) && (HoehenWert < 15 * 100))  // and we are at the starting point -> maybe landed? 
-
 
907
                                {
-
 
908
                                 GasIsZeroCnt = 30000;
-
 
909
                                 if(modell_fliegt > 1001) modell_fliegt = 1001;
-
 
910
                                }        
-
 
911
                         }
-
 
912
                        }
891
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
913
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
892
// neue Werte von der Funke
914
// neue Werte von der Funke
893
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
915
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 894... Line 916...
894
 
916
 
Line 1018... Line 1040...
1018
 
1040
 
1019
 
1041
 
1020
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1042
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
1043
// Bei Empfangsausfall im Flug
-
 
1044
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
1045
DebugOut.Analog[16] = GasIsZeroCnt;
1021
// Bei Empfangsausfall im Flug
1046
DebugOut.Analog[17] = VarioMeter;
1022
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1047
 
1023
   if(FC_StatusFlags2 & FC_STATUS2_RC_FAILSAVE_ACTIVE)
1048
   if(FC_StatusFlags2 & FC_STATUS2_RC_FAILSAVE_ACTIVE)
1024
   {
1049
   {
1025
    StickNick = -GPS_Nick;
1050
    StickNick = -GPS_Nick;
1026
    StickRoll = -GPS_Roll;
1051
    StickRoll = -GPS_Roll;
1027
        StickGas  = StickGasHover;
1052
        StickGas = StickGasHover;
1028
        Parameter_GlobalConfig &= ~(CFG_HEADING_HOLD | CFG_DREHRATEN_BEGRENZER);
1053
        Parameter_GlobalConfig &= ~(CFG_HEADING_HOLD | CFG_DREHRATEN_BEGRENZER);
1029
        Parameter_GlobalConfig |= CFG_HOEHENREGELUNG | CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER | CFG_GPS_AKTIV;
1054
        Parameter_GlobalConfig |= CFG_HOEHENREGELUNG | CFG_ACHSENKOPPLUNG_AKTIV | CFG_KOMPASS_AKTIV | CFG_GPS_AKTIV | CFG_HOEHEN_SCHALTER | CFG_GPS_AKTIV;
1030
        Parameter_ExtraConfig &= ~(CFG2_HEIGHT_LIMIT | CFG_LEARNABLE_CAREFREE | CFG2_VARIO_BEEP);
1055
        Parameter_ExtraConfig &= ~(CFG2_HEIGHT_LIMIT | CFG_LEARNABLE_CAREFREE | CFG2_VARIO_BEEP);
Line 1042... Line 1067...
1042
     IntegralFaktorGier = 120;
1067
     IntegralFaktorGier = 120;
1043
     Looping_Roll = 0;
1068
     Looping_Roll = 0;
1044
     Looping_Nick = 0;
1069
     Looping_Nick = 0;
1045
    }
1070
    }
Line 1046... Line -...
1046
 
-
 
1047
 
1071
 
1048
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1072
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1049
// Integrale auf ACC-Signal abgleichen
1073
// Integrale auf ACC-Signal abgleichen
1050
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1074
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++