Subversion Repositories FlightCtrl

Rev

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

Rev 459 Rev 501
Line 77... Line 77...
77
unsigned char HoehenReglerAktiv = 0;
77
unsigned char HoehenReglerAktiv = 0;
Line 78... Line 78...
78
 
78
 
79
unsigned char blinkcount_LED1 = 0;//Hilfszähler für die blinkende LED (310807Kr)
79
unsigned char blinkcount_LED1 = 0;//Hilfszähler für die blinkende LED (310807Kr)
80
unsigned int modell_fliegt_gps = 0;//(030907Kr)
80
unsigned int modell_fliegt_gps = 0;//(030907Kr)
-
 
81
unsigned char Limit_D_Anteil = 0;//(210907Kr)
Line 81... Line 82...
81
unsigned char Limit_D_Anteil = 0;//(210907Kr)
82
unsigned char Limit_P_Anteil = 0;//(131107Kr)
82
 
83
 
Line 83... Line 84...
83
float GyroFaktor;
84
float GyroFaktor;
Line 325... Line 326...
325
// + 252 -> Poti2
326
// + 252 -> Poti2
326
// + 253 -> Poti3
327
// + 253 -> Poti3
327
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
328
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
328
void DefaultKonstanten1(void)
329
void DefaultKonstanten1(void)
329
{
330
{
330
 EE_Parameter.Kanalbelegung[K_NICK]  = 1;
331
 EE_Parameter.Kanalbelegung[K_NICK]  = 3; // (300807Kr)
331
 EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
332
 EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
332
 EE_Parameter.Kanalbelegung[K_GAS]   = 3;
333
 EE_Parameter.Kanalbelegung[K_GAS]   = 1; // (300807Kr)
333
 EE_Parameter.Kanalbelegung[K_GIER]  = 4;
334
 EE_Parameter.Kanalbelegung[K_GIER]  = 4;
334
 EE_Parameter.Kanalbelegung[K_POTI1] = 5;
335
 EE_Parameter.Kanalbelegung[K_POTI1] = 5;
335
 EE_Parameter.Kanalbelegung[K_POTI2] = 6;
336
 EE_Parameter.Kanalbelegung[K_POTI2] = 6;
336
 EE_Parameter.Kanalbelegung[K_POTI3] = 7;
337
 EE_Parameter.Kanalbelegung[K_POTI3] = 7;
337
 EE_Parameter.Kanalbelegung[K_POTI4] = 8;
338
 EE_Parameter.Kanalbelegung[K_POTI4] = 8;
Line 349... Line 350...
349
 EE_Parameter.Gas_Max = 250;           // Wert : 33-250
350
 EE_Parameter.Gas_Max = 250;           // Wert : 33-250
350
 EE_Parameter.GyroAccFaktor = 26;      // Wert : 1-64
351
 EE_Parameter.GyroAccFaktor = 26;      // Wert : 1-64
351
 EE_Parameter.KompassWirkung = 128;    // Wert : 0-250
352
 EE_Parameter.KompassWirkung = 128;    // Wert : 0-250
352
 EE_Parameter.Gyro_P = 120; //80          // Wert : 0-250
353
 EE_Parameter.Gyro_P = 120; //80          // Wert : 0-250
353
 EE_Parameter.Gyro_I = 150;               // Wert : 0-250
354
 EE_Parameter.Gyro_I = 150;               // Wert : 0-250
354
 EE_Parameter.UnterspannungsWarnung = 95;  // Wert : 0-250 // (160607Kr)
355
 EE_Parameter.UnterspannungsWarnung = 94;  // Wert : 0-250
355
 EE_Parameter.NotGas = 35;                // Wert : 0-250     // Gaswert bei Empangsverlust
356
 EE_Parameter.NotGas = 35;                // Wert : 0-250     // Gaswert bei Empangsverlust
356
 EE_Parameter.NotGasZeit = 20;            // Wert : 0-250     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
357
 EE_Parameter.NotGasZeit = 20;            // Wert : 0-250     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
357
 EE_Parameter.UfoAusrichtung = 0;         // X oder + Formation
358
 EE_Parameter.UfoAusrichtung = 0;         // X oder + Formation
358
 EE_Parameter.I_Faktor = 5;
359
 EE_Parameter.I_Faktor = 5;
359
 EE_Parameter.UserParam1 = 0;             //zur freien Verwendung
360
 EE_Parameter.UserParam1 = 0;             //zur freien Verwendung
Line 372... Line 373...
372
 memcpy(EE_Parameter.Name, "Sport\0", 12);  
373
 memcpy(EE_Parameter.Name, "Sport\0", 12);  
373
}
374
}
Line 374... Line 375...
374
 
375
 
375
void DefaultKonstanten2(void)
376
void DefaultKonstanten2(void)
376
{
377
{
377
 EE_Parameter.Kanalbelegung[K_NICK]  = 1;
378
 EE_Parameter.Kanalbelegung[K_NICK]  = 3; // (300807Kr)
378
 EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
379
 EE_Parameter.Kanalbelegung[K_ROLL]  = 2;
379
 EE_Parameter.Kanalbelegung[K_GAS]   = 3;
380
 EE_Parameter.Kanalbelegung[K_GAS]   = 1; // (300807Kr)
380
 EE_Parameter.Kanalbelegung[K_GIER]  = 4;
381
 EE_Parameter.Kanalbelegung[K_GIER]  = 4;
381
 EE_Parameter.Kanalbelegung[K_POTI1] = 5;
382
 EE_Parameter.Kanalbelegung[K_POTI1] = 5;
382
 EE_Parameter.Kanalbelegung[K_POTI2] = 6;
383
 EE_Parameter.Kanalbelegung[K_POTI2] = 6;
383
 EE_Parameter.Kanalbelegung[K_POTI3] = 7;
384
 EE_Parameter.Kanalbelegung[K_POTI3] = 7;
Line 396... Line 397...
396
 EE_Parameter.Gas_Max = 250;          // Wert : 33-250
397
 EE_Parameter.Gas_Max = 250;          // Wert : 33-250
397
 EE_Parameter.GyroAccFaktor = 26;     // Wert : 1-64
398
 EE_Parameter.GyroAccFaktor = 26;     // Wert : 1-64
398
 EE_Parameter.KompassWirkung = 128;    // Wert : 0-250
399
 EE_Parameter.KompassWirkung = 128;    // Wert : 0-250
399
 EE_Parameter.Gyro_P = 175; //80           // Wert : 0-250
400
 EE_Parameter.Gyro_P = 175; //80           // Wert : 0-250
400
 EE_Parameter.Gyro_I = 175;           // Wert : 0-250
401
 EE_Parameter.Gyro_I = 175;           // Wert : 0-250
401
 EE_Parameter.UnterspannungsWarnung = 95;  // Wert : 0-250 // (160607Kr)
402
 EE_Parameter.UnterspannungsWarnung = 94;  // Wert : 0-250
402
 EE_Parameter.NotGas = 35;                 // Wert : 0-250     // Gaswert bei Empangsverlust
403
 EE_Parameter.NotGas = 35;                 // Wert : 0-250     // Gaswert bei Empangsverlust
403
 EE_Parameter.NotGasZeit = 20;             // Wert : 0-250     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
404
 EE_Parameter.NotGasZeit = 20;             // Wert : 0-250     // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen
404
 EE_Parameter.UfoAusrichtung = 0;         // X oder + Formation
405
 EE_Parameter.UfoAusrichtung = 0;         // X oder + Formation
405
 EE_Parameter.I_Faktor = 5;
406
 EE_Parameter.I_Faktor = 5;
406
 EE_Parameter.UserParam1 = 0;   //zur freien Verwendung
407
 EE_Parameter.UserParam1 = 0;   //zur freien Verwendung
Line 654... Line 655...
654
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
655
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
655
// LED Stuff
656
// LED Stuff
656
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
657
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Line 657... Line 658...
657
 
658
 
-
 
659
        #define LED1_ONTIME 20
Line 658... Line 660...
658
        #define LED1_ONTIME 20
660
        #define LED1_TOTALTIME 60 //um das Blinkverhalten per Fernsteuerung zu beeinflussen, kann in der LED Routine anstelle von "LED1_TOTALTIME" auch "Parameter_UserParam4" stehen 
Line 659... Line 661...
659
       
661
       
660
        LED1_OFF;
662
        LED1_OFF;
661
       
663
       
662
        if(Parameter_UserParam4 >= 200)
664
        if(LED1_TOTALTIME >= 200)
663
        {
665
        {
Line 664... Line 666...
664
        LED1_ON;
666
        LED1_ON;
665
        blinkcount_LED1 = 0;
667
        blinkcount_LED1 = 0;
666
        }
668
        }
Line 667... Line 669...
667
       
669
       
668
        else if(blinkcount_LED1 >= Parameter_UserParam4 && Parameter_UserParam4 > 0 && MotorenEin == 1)
670
        else if(blinkcount_LED1 >= LED1_TOTALTIME && LED1_TOTALTIME > 0 && MotorenEin == 1)
669
        {
671
        {
670
        LED1_ON;
672
        LED1_ON;
671
       
673
       
672
                if(blinkcount_LED1 >= LED1_ONTIME + Parameter_UserParam4)
674
                if(blinkcount_LED1 >= LED1_ONTIME + LED1_TOTALTIME)
Line 811... Line 813...
811
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        
813
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        
812
        if(EE_Parameter.GlobalConfig & CFG_GPS_AKTIV)
814
        if(EE_Parameter.GlobalConfig & CFG_GPS_AKTIV)
813
        {
815
        {
814
          P_GPS_Verstaerkung = Parameter_UserParam1;
816
          P_GPS_Verstaerkung = Parameter_UserParam1;
815
          D_GPS_Verstaerkung = Parameter_UserParam2;
817
          D_GPS_Verstaerkung = Parameter_UserParam2;
-
 
818
          Limit_P_Anteil = Parameter_UserParam3;
816
          Limit_D_Anteil = Parameter_UserParam3;
819
          Limit_D_Anteil = Parameter_UserParam4;
817
          gps_main();  
820
          gps_main();  
818
        }
821
        }
819
        else
822
        else
820
        {
823
        {
821
          GPS_Nick = 0;
824
          GPS_Nick = 0;
Line 826... Line 829...
826
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
829
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                
827
  if(!TimerWerteausgabe--)
830
  if(!TimerWerteausgabe--)
828
   {
831
   {
829
    TimerWerteausgabe = 49;
832
    TimerWerteausgabe = 49;
Line 830... Line 833...
830
 
833
 
831
        DebugOut.Analog[0] = SenderOkay;
834
    DebugOut.Analog[0] = IntegralNick / EE_Parameter.GyroAccFaktor;
832
        DebugOut.Analog[1] = GPS_Roll;
835
    DebugOut.Analog[1] = IntegralRoll / EE_Parameter.GyroAccFaktor;
833
        DebugOut.Analog[2] = GPS_Nick;
836
    DebugOut.Analog[2] = Mittelwert_AccNick;
834
        DebugOut.Analog[3] = GPS_Positionsabweichung_North;
837
    DebugOut.Analog[3] = Mittelwert_AccRoll;
835
        DebugOut.Analog[4] = GPS_Positionsabweichung_East;
838
        DebugOut.Analog[4] = Parameter_UserParam1;
836
        DebugOut.Analog[5] = P_Einfluss_East;
839
    DebugOut.Analog[5] = Parameter_UserParam2;
837
        DebugOut.Analog[6] = D_Einfluss_East;
840
        DebugOut.Analog[6] = Parameter_UserParam3;
838
        DebugOut.Analog[7] = P_Einfluss_North;
841
    DebugOut.Analog[7] = Parameter_UserParam4;
839
        DebugOut.Analog[8] = D_Einfluss_North;
842
        DebugOut.Analog[8] = KompassValue;
840
        DebugOut.Analog[9] = Soll_Position_North;
843
        DebugOut.Analog[9] = UBat;
841
        DebugOut.Analog[10] = Soll_Position_East;
844
        DebugOut.Analog[10] = SenderOkay;
842
        DebugOut.Analog[11] = Parameter_UserParam1;
845
        DebugOut.Analog[11] = actualPos.GPSFix;
843
    DebugOut.Analog[12] = Parameter_UserParam2;
846
        DebugOut.Analog[12] = motor_rx[0];      //Motorstrom vorne
844
        DebugOut.Analog[13] = Poti3;
847
        DebugOut.Analog[13] = motor_rx[1];      //Motorstrom hinten
845
        DebugOut.Analog[14] = KompassValue;
848
        DebugOut.Analog[14] = motor_rx[2];      //Motorstrom links
846
        DebugOut.Analog[15] = NORTH_MITTEL;
849
        DebugOut.Analog[15] = motor_rx[3];      //Motorstrom rechts
847
        DebugOut.Analog[16] = EAST_MITTEL;
850
        DebugOut.Analog[16] = Poti3;
848
        DebugOut.Analog[17] = actualPos.altitude;
851
        DebugOut.Analog[17] = actualPos.altitude;
849
        DebugOut.Analog[18] = actualPos.GSpeed;
852
        DebugOut.Analog[18] = actualPos.velNorth;
850
        DebugOut.Analog[19] = actualPos.northing;
853
        DebugOut.Analog[19] = actualPos.velEast;       
851
        DebugOut.Analog[20] = actualPos.easting;
854
        DebugOut.Analog[20] = GPS_Positionsabweichung_North;
852
        DebugOut.Analog[21] = actualPos.velNorth;
855
        DebugOut.Analog[21] = GPS_Positionsabweichung_East;    
853
        DebugOut.Analog[22] = actualPos.velEast;
856
        DebugOut.Analog[22] = P_Einfluss_North;
854
        DebugOut.Analog[23] = UBat;
857
        DebugOut.Analog[23] = P_Einfluss_East;
855
    DebugOut.Analog[24] = (motor_rx[0]+motor_rx[1]+motor_rx[2]+motor_rx[3]); //Gesamtstrom
858
        DebugOut.Analog[24] = D_Einfluss_North;
856
    DebugOut.Analog[25] = StickRoll;
859
        DebugOut.Analog[25] = D_Einfluss_East;
857
        DebugOut.Analog[26] = HoehenWert;
860
        DebugOut.Analog[26] = GPS_North;
858
    DebugOut.Analog[27] = IntegralNick / EE_Parameter.GyroAccFaktor;
861
        DebugOut.Analog[27] = GPS_East;
859
    DebugOut.Analog[28] = IntegralRoll / EE_Parameter.GyroAccFaktor;
862
        DebugOut.Analog[28] = GPS_Roll;
860
    DebugOut.Analog[29] = Mittelwert_AccNick;
863
        DebugOut.Analog[29] = GPS_Nick;
861
    DebugOut.Analog[30] = Mittelwert_AccRoll;
864
        DebugOut.Analog[30] = StickNick;
-
 
865
        DebugOut.Analog[31] = StickRoll;
-
 
866
       
862
        DebugOut.Analog[31] = StickNick;
867
        //DebugOut.Analog[32] = (motor_rx[0]+motor_rx[1]+motor_rx[2]+motor_rx[3]); //Gesamtstrom
863
        //DebugOut.Analog[32] = StickGier;
868
        //DebugOut.Analog[33] = StickGier;
864
        //DebugOut.Analog[33] = actualPos.GPSFix;
869
        //DebugOut.Analog[34] = actualPos.GSpeed;
865
        //DebugOut.Analog[34] = motor_rx[0];    //Motorstrom vorne
870
        //DebugOut.Analog[35] = GPS_Home_North;
866
        //DebugOut.Analog[35] = motor_rx[1];    //Motorstrom hinten
871
        //DebugOut.Analog[36] = GPS_Home_East;
867
        //DebugOut.Analog[36] = motor_rx[2];    //Motorstrom links
872
        //DebugOut.Analog[37] = Soll_Position_North;
868
        //DebugOut.Analog[37] = motor_rx[3];    //Motorstrom rechts     
873
        //DebugOut.Analog[38] = Soll_Position_East;
-
 
874
        //DebugOut.Analog[39] = actualPos.northing;
869
        //DebugOut.Analog[38] = GPS_Home_North;
875
        //DebugOut.Analog[40] = actualPos.easting;
870
        //DebugOut.Analog[39] = GPS_Home_East;
876
        //DebugOut.Analog[41] = NORTH_MITTEL;
Line 871... Line 877...
871
        //DebugOut.Analog[40] = newData_navPosUtm;
877
        //DebugOut.Analog[42] = EAST_MITTEL;
Line 872... Line 878...
872
 
878
 
Line 903... Line 909...
903
    int tmp_int;
909
    int tmp_int;
904
    if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)  // Regler wird über Schalter gesteuert
910
    if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)  // Regler wird über Schalter gesteuert
905
    {
911
    {
906
     if(Parameter_MaxHoehe < 50)
912
     if(Parameter_MaxHoehe < 50)
907
      {
913
      {
908
       SollHoehe = HoehenWert - 40;  // Parameter_MaxHoehe ist der PPM-Wert des Schalters // (160607Kr)
914
       SollHoehe = HoehenWert - 20;  // Parameter_MaxHoehe ist der PPM-Wert des Schalters
909
       HoehenReglerAktiv = 0;
915
       HoehenReglerAktiv = 0;
910
      }
916
      }
911
      else  
917
      else  
912
        HoehenReglerAktiv = 1;
918
        HoehenReglerAktiv = 1;
913
    }
919
    }
914
    else
920
    else
915
    {
921
    {
916
     SollHoehe = Parameter_MaxHoehe * EE_Parameter.Hoehe_Verstaerkung - 40; // (160607Kr)
922
     SollHoehe = Parameter_MaxHoehe * EE_Parameter.Hoehe_Verstaerkung - 20;
917
     HoehenReglerAktiv = 1;
923
     HoehenReglerAktiv = 1;
918
    }
924
    }
Line 919... Line 925...
919
 
925
 
920
    if(Notlandung) SollHoehe = 0;
926
    if(Notlandung) SollHoehe = 0;