Subversion Repositories FlightCtrl

Rev

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

Rev 856 Rev 871
Line 121... Line 121...
121
unsigned char Parameter_AchsGegenKopplung1 = 0;
121
unsigned char Parameter_AchsGegenKopplung1 = 0;
122
unsigned char Parameter_DynamicStability = 100;
122
unsigned char Parameter_DynamicStability = 100;
123
struct mk_param_struct EE_Parameter;
123
struct mk_param_struct EE_Parameter;
124
signed int ExternStickNick = 0,ExternStickRoll = 0,ExternStickGier = 0, ExternHoehenValue = -20;
124
signed int ExternStickNick = 0,ExternStickRoll = 0,ExternStickGier = 0, ExternHoehenValue = -20;
125
int MaxStickNick = 0,MaxStickRoll = 0;
125
int MaxStickNick = 0,MaxStickRoll = 0;
-
 
126
unsigned int  modell_fliegt = 0;
Line 126... Line 127...
126
 
127
 
127
void Piep(unsigned char Anzahl)
128
void Piep(unsigned char Anzahl)
128
{
129
{
129
 while(Anzahl--)
130
 while(Anzahl--)
Line 426... Line 427...
426
     static long IntegralFehlerNick = 0;
427
     static long IntegralFehlerNick = 0;
427
     static long IntegralFehlerRoll = 0;
428
     static long IntegralFehlerRoll = 0;
428
         static unsigned int RcLostTimer;
429
         static unsigned int RcLostTimer;
429
         static unsigned char delay_neutral = 0;
430
         static unsigned char delay_neutral = 0;
430
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
431
         static unsigned char delay_einschalten = 0,delay_ausschalten = 0;
431
         static unsigned int  modell_fliegt = 0;
-
 
432
     static int hoehenregler = 0;
432
     static int hoehenregler = 0;
433
     static char TimerWerteausgabe = 0;
433
     static char TimerWerteausgabe = 0;
434
     static char NeueKompassRichtungMerken = 0;
434
     static char NeueKompassRichtungMerken = 0;
435
     static long ausgleichNick, ausgleichRoll;
435
     static long ausgleichNick, ausgleichRoll;
Line 484... Line 484...
484
            RcLostTimer = EE_Parameter.NotGasZeit * 50;
484
            RcLostTimer = EE_Parameter.NotGasZeit * 50;
485
            if(GasMischanteil > 40)
485
            if(GasMischanteil > 40)
486
                {
486
                {
487
                if(modell_fliegt < 0xffff) modell_fliegt++;
487
                if(modell_fliegt < 0xffff) modell_fliegt++;
488
                }
488
                }
489
            if((modell_fliegt < 200))
489
            if((modell_fliegt < 256))
490
                {
490
                {
491
                SummeNick = 0;
491
                SummeNick = 0;
492
                SummeRoll = 0;
492
                SummeRoll = 0;
493
//                StickGier = 0;
-
 
494
//                Mess_Integral_Gier = 0;       
-
 
495
//                Mess_Integral_Gier2 = 0;
493
                if(modell_fliegt == 260) NeueKompassRichtungMerken = 1;
496
                }
494
                }
497
            if((PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 80) && MotorenEin == 0)
495
            if((PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 80) && MotorenEin == 0)
498
                {
496
                {
499
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
497
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
500
// auf Nullwerte kalibrieren
498
// auf Nullwerte kalibrieren
Line 633... Line 631...
633
    IntegralFaktor = ((float) Parameter_Gyro_I) / (44000 / STICK_GAIN);
631
    IntegralFaktor = ((float) Parameter_Gyro_I) / (44000 / STICK_GAIN);
Line 634... Line 632...
634
 
632
 
635
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
633
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
636
//+ Digitale Steuerung per DubWise
634
//+ Digitale Steuerung per DubWise
637
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
635
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
638
#define KEY_VALUE (Parameter_UserParam1 * 4)  //(Poti3 * 8)
636
#define KEY_VALUE (Parameter_UserParam8 * 4)  //(Poti3 * 8)
639
if(DubWiseKeys[1]) beeptime = 10;
637
if(DubWiseKeys[1]) beeptime = 10;
640
    if(DubWiseKeys[1] & DUB_KEY_UP)    tmp_int = KEY_VALUE;   else
638
    if(DubWiseKeys[1] & DUB_KEY_UP)    tmp_int = KEY_VALUE;   else
641
    if(DubWiseKeys[1] & DUB_KEY_DOWN)  tmp_int = -KEY_VALUE;  else   tmp_int = 0;
639
    if(DubWiseKeys[1] & DUB_KEY_DOWN)  tmp_int = -KEY_VALUE;  else   tmp_int = 0;
642
    ExternStickNick = (ExternStickNick * 7 + tmp_int) / 8;
640
    ExternStickNick = (ExternStickNick * 7 + tmp_int) / 8;
Line 653... Line 651...
653
    StickRoll += (STICK_GAIN * ExternStickRoll) / 8;
651
    StickRoll += (STICK_GAIN * ExternStickRoll) / 8;
654
    StickGier += STICK_GAIN * ExternStickGier;
652
    StickGier += STICK_GAIN * ExternStickGier;
655
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
653
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
656
//+ Analoge Steuerung per Seriell
654
//+ Analoge Steuerung per Seriell
657
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
655
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
658
   if(ExternControl.Config & 0x01 && Parameter_UserParam1 > 128)
656
   if(ExternControl.Config & 0x01 && Parameter_UserParam8 > 128)
659
    {
657
    {
660
         StickNick += (int) ExternControl.Nick * (int) EE_Parameter.Stick_P;
658
         StickNick += (int) ExternControl.Nick * (int) EE_Parameter.Stick_P;
661
         StickRoll += (int) ExternControl.Roll * (int) EE_Parameter.Stick_P;
659
         StickRoll += (int) ExternControl.Roll * (int) EE_Parameter.Stick_P;
662
         StickGier += ExternControl.Gier;
660
         StickGier += ExternControl.Gier;
663
     ExternHoehenValue =  (int) ExternControl.Hight * (int)EE_Parameter.Hoehe_Verstaerkung;
661
     ExternHoehenValue =  (int) ExternControl.Hight * (int)EE_Parameter.Hoehe_Verstaerkung;
Line 1133... Line 1131...
1133
    h = HoehenWert;
1131
    h = HoehenWert;
1134
    if((h > SollHoehe) && HoehenReglerAktiv)      // zu hoch --> drosseln
1132
    if((h > SollHoehe) && HoehenReglerAktiv)      // zu hoch --> drosseln
1135
     {      
1133
     {      
1136
      h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / (16 / STICK_GAIN); // Differenz bestimmen --> P-Anteil
1134
      h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / (16 / STICK_GAIN); // Differenz bestimmen --> P-Anteil
1137
      h = GasMischanteil - h;         // vom Gas abziehen
1135
      h = GasMischanteil - h;         // vom Gas abziehen
1138
      h -= (HoeheD * Parameter_Luftdruck_D)/(8/STICK_GAIN);    // D-Anteil
1136
//      h -= (HoeheD * Parameter_Luftdruck_D)/(8/STICK_GAIN);    // D-Anteil
-
 
1137
      h -= (HoeheD)/(8/STICK_GAIN);    // D-Anteil
1139
      tmp_int = ((Mess_Integral_Hoch / 512) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (32 / STICK_GAIN);
1138
      tmp_int = ((Mess_Integral_Hoch / 128) * (signed long) Parameter_Hoehe_ACC_Wirkung) / (128 / STICK_GAIN);
1140
      if(tmp_int > 50*STICK_GAIN) tmp_int = 50*STICK_GAIN;
1139
      if(tmp_int > 70*STICK_GAIN) tmp_int = 70*STICK_GAIN;
1141
      else if(tmp_int < -(50*STICK_GAIN)) tmp_int = -(50*STICK_GAIN);
1140
      else if(tmp_int < -(70*STICK_GAIN)) tmp_int = -(70*STICK_GAIN);
1142
      h -= tmp_int;
1141
      h -= tmp_int;
1143
      hoehenregler = (hoehenregler*15 + h) / 16;      
1142
      hoehenregler = (hoehenregler*15 + h) / 16;      
1144
      if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN
1143
      if(hoehenregler < EE_Parameter.Hoehe_MinGas * STICK_GAIN) // nicht unter MIN
1145
       {
1144
       {
1146
         if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN;
1145
         if(GasMischanteil >= EE_Parameter.Hoehe_MinGas * STICK_GAIN) hoehenregler = EE_Parameter.Hoehe_MinGas * STICK_GAIN;