Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
438 Nick666 1
/*#######################################################################################
2
Flight Control
3
#######################################################################################*/
4
 
5
#ifndef _FC_H
6
#define _FC_H
7
 
8
extern volatile unsigned int I2CTimeout;
9
extern unsigned char Sekunde,Minute;
479 Nick666 10
extern long IntegralNick,IntegralNick2;
11
extern long IntegralRoll,IntegralRoll2;
12
extern long Integral_Gier;
438 Nick666 13
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
14
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
479 Nick666 15
extern long IntegralAccNick,IntegralAccRoll;
16
volatile long Mess_Integral_Hoch;
17
extern volatile long Mess_Integral_Gier,Mess_Integral_Gier2;
18
extern int KompassValue;
19
extern int KompassStartwert;
20
extern int KompassRichtung;
438 Nick666 21
extern int HoehenWert;
22
extern int SollHoehe;
479 Nick666 23
extern int MesswertNick,MesswertRoll,MesswertGier;
24
int AdNeutralNick,AdNeutralRoll,AdNeutralGier;
25
int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch;
438 Nick666 26
extern long Umschlag180Nick, Umschlag180Roll;
27
 
28
void MotorRegler(void);
29
void SendMotorData(void);
30
void CalibrierMittelwert(void);
31
void Mittelwert(void);
32
void SetNeutral(void);
33
void Piep(unsigned char Anzahl);
34
extern void DefaultKonstanten(void);
35
void DefaultKonstanten1(void);
36
void DefaultKonstanten2(void);
37
 
38
extern unsigned char h,m,s;
479 Nick666 39
extern volatile unsigned char Timeout;
40
extern int DiffNick,DiffRoll;
41
extern int Poti1, Poti2, Poti3, Poti4;
438 Nick666 42
extern volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
43
extern unsigned char MotorWert[5];
44
extern volatile unsigned char SenderOkay;
45
extern int StickNick,StickRoll,StickGier;
46
extern char MotorenEin;
47
 
48
#define  STRUCT_PARAM_LAENGE  65
49
struct mk_param_struct
50
 {
51
   unsigned char Kanalbelegung[8];        // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
52
   unsigned char GlobalConfig;            // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
53
   unsigned char Hoehe_MinGas;            // Wert : 0-100
54
   unsigned char Luftdruck_D;             // Wert : 0-250
55
   unsigned char MaxHoehe;                // Wert : 0-32
56
   unsigned char Hoehe_P;                 // Wert : 0-32
57
   unsigned char Hoehe_Verstaerkung;      // Wert : 0-50
58
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
59
   unsigned char Stick_P;                // Wert : 1-6
60
   unsigned char Stick_D;                // Wert : 0-64
61
   unsigned char Gier_P;                 // Wert : 1-20
62
   unsigned char Gas_Min;                // Wert : 0-32
63
   unsigned char Gas_Max;                // Wert : 33-250
64
   unsigned char GyroAccFaktor;          // Wert : 1-64
65
   unsigned char KompassWirkung;         // Wert : 0-32
66
   unsigned char Gyro_P;                 // Wert : 10-250
67
   unsigned char Gyro_I;                 // Wert : 0-250
68
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
69
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
70
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
71
   unsigned char UfoAusrichtung;         // X oder + Formation
72
   unsigned char I_Faktor;               // Wert : 0-250
73
   unsigned char UserParam1;             // Wert : 0-250
74
   unsigned char UserParam2;             // Wert : 0-250
75
   unsigned char UserParam3;             // Wert : 0-250
76
   unsigned char UserParam4;             // Wert : 0-250
77
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
78
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
79
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
80
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
81
   unsigned char ServoNickRefresh;       //
82
   unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
83
   unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
84
   unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
85
   unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
86
   unsigned char AchsGegenKopplung1;     // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung)
87
   unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
88
   unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
89
   unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
90
   unsigned char Driftkomp;
91
 
92
//------------------------------------------------
93
   unsigned char LoopConfig;             // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
94
   unsigned char ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
95
   unsigned char Reserved[4];
96
   char Name[12];
97
 };
98
 
99
 
479 Nick666 100
struct acc_neutral_struct
101
{
102
        volatile int X;
103
        volatile int Y;
104
        volatile float Z;
105
};
106
 
107
extern struct acc_neutral_struct acc_neutral;
108
extern void calib_acc(void);
109
 
438 Nick666 110
/*
111
unsigned char ServoNickMax;           // Wert : 0-250
112
    unsigned char ServoNickRefresh;       //
113
    unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
114
    unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
115
//------------------------------------------------
116
    unsigned char LoopConfig;             // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
117
    unsigned char ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
118
    unsigned char Reserved[4];
119
    char Name[12];
120
*/
121
 
122
extern struct mk_param_struct EE_Parameter;
123
 
124
extern unsigned char Parameter_Luftdruck_D;
125
extern unsigned char Parameter_MaxHoehe;
126
extern unsigned char Parameter_Hoehe_P;
127
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
128
extern unsigned char Parameter_KompassWirkung;
129
extern unsigned char Parameter_Gyro_P;
130
extern unsigned char Parameter_Gyro_I;
131
extern unsigned char Parameter_Gier_P;
132
extern unsigned char Parameter_ServoNickControl;
133
extern unsigned char Parameter_AchsKopplung1;
134
extern unsigned char Parameter_AchsGegenKopplung1;
135
 
136
 
137
#endif //_FC_H
138