Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1068 thjac 1
/*#######################################################################################
2
Flight Control
3
#######################################################################################*/
4
 
5
#ifndef _FC_H
6
#define _FC_H
7
//#define GIER_GRAD_FAKTOR 1450L // Abhängigkeit wzischen GyroIntegral und Winkel
8
#define GIER_GRAD_FAKTOR 1550L // Abhängigkeit wzischen GyroIntegral und Winkel
9
#define STICK_GAIN_SHIFT 2
10
 
11
#define FLAG_MOTOR_RUN  1
12
#define FLAG_FLY        2
13
#define FLAG_CALIBRATE  4
14
#define FLAG_START      8
15
extern unsigned char MikroKopterFlags;
16
 
17
extern volatile unsigned int I2CTimeout;
18
extern unsigned char Sekunde,Minute;
19
extern long IntegralNick,IntegralNick2;
20
extern long IntegralRoll,IntegralRoll2;
21
extern long Mess_IntegralNick,Mess_IntegralNick2;
22
extern long Mess_IntegralRoll,Mess_IntegralRoll2;
23
extern long IntegralAccNick,IntegralAccRoll;
24
extern volatile long Mess_Integral_Hoch;
25
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
26
extern volatile int  KompassValue;
27
extern volatile int  KompassStartwert;
28
extern volatile int  KompassRichtung;
29
extern long  ErsatzKompass;
30
extern int   ErsatzKompassInGrad; // Kompasswert in Grad
31
extern volatile int MesswertNick,MesswertRoll,MesswertGier;
32
extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
33
extern int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
34
extern volatile float NeutralAccZ;
35
extern long Umschlag180Nick, Umschlag180Roll;
36
extern signed int ExternStickNick,ExternStickRoll,ExternStickGier;
37
extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8;
38
extern int NaviAccNick,NaviAccRoll,NaviCntAcc;
39
extern unsigned int modell_fliegt;
40
void MotorRegler(void);
41
void SendMotorData(void);
42
void CalibrierMittelwert(void);
43
void Mittelwert(void);
44
void SetNeutral(void);
45
void Piep(unsigned char Anzahl);
46
extern void DefaultKonstanten(void);
47
void DefaultKonstanten1(void);
48
void DefaultKonstanten2(void);
49
 
50
extern unsigned char h,m,s;
51
extern volatile unsigned char Timeout ;
52
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
53
extern volatile int  DiffNick,DiffRoll;
54
extern int  Poti1, Poti2, Poti3, Poti4;
55
extern volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
56
extern volatile unsigned char SenderOkay;
57
extern int StickNick,StickRoll,StickGier;
58
extern char MotorenEin;
59
extern void DefaultKonstanten1(void);
60
extern void DefaultKonstanten2(void);
61
 
62
#define  STRUCT_PARAM_LAENGE  83
63
struct mk_param_struct
64
 {
65
   unsigned char Kanalbelegung[8];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
66
   unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
67
   unsigned char Hoehe_MinGas;           // Wert : 0-100
68
   unsigned char Luftdruck_D;            // Wert : 0-250
69
   unsigned char MaxHoehe;               // Wert : 0-32
70
   unsigned char Hoehe_P;                // Wert : 0-32
71
   unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
72
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
73
   unsigned char Stick_P;                // Wert : 1-6
74
   unsigned char Stick_D;                // Wert : 0-64
75
   unsigned char Gier_P;                 // Wert : 1-20
76
   unsigned char Gas_Min;                // Wert : 0-32
77
   unsigned char Gas_Max;                // Wert : 33-250
78
   unsigned char GyroAccFaktor;          // Wert : 1-64
79
   unsigned char KompassWirkung;         // Wert : 0-32
80
   unsigned char Gyro_P;                 // Wert : 10-250
81
   unsigned char Gyro_I;                 // Wert : 0-250
82
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
83
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
84
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
85
   unsigned char UfoAusrichtung;         // X oder + Formation
86
   unsigned char I_Faktor;               // Wert : 0-250
87
   unsigned char UserParam1;             // Wert : 0-250
88
   unsigned char UserParam2;             // Wert : 0-250
89
   unsigned char UserParam3;             // Wert : 0-250
90
   unsigned char UserParam4;             // Wert : 0-250
91
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
92
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
93
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
94
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
95
   unsigned char ServoNickRefresh;       //
96
   unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
97
   unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
98
   unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
99
   unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
100
   unsigned char AchsGegenKopplung1;     // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung)
101
   unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
102
   unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
103
   unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
104
   unsigned char Driftkomp;              
105
   unsigned char DynamicStability;
106
   unsigned char UserParam5;             // Wert : 0-250
107
   unsigned char UserParam6;             // Wert : 0-250
108
   unsigned char UserParam7;             // Wert : 0-250
109
   unsigned char UserParam8;             // Wert : 0-250
110
//---Output ---------------------------------------------
111
   unsigned char J16Bitmask;             // for the J16 Output
112
   unsigned char J16Timing;              // for the J16 Output
113
   unsigned char J17Bitmask;             // for the J17 Output
114
   unsigned char J17Timing;              // for the J17 Output
115
//---NaviCtrl---------------------------------------------
116
   unsigned char NaviGpsModeControl;     // Parameters for the Naviboard
117
   unsigned char NaviGpsGain;    
118
   unsigned char NaviGpsP;        
119
   unsigned char NaviGpsI;        
120
   unsigned char NaviGpsD;        
121
   unsigned char NaviGpsACC;        
122
   unsigned char NaviGpsMinSat;        
123
   unsigned char NaviStickThreshold;        
124
//---Ext.Ctrl---------------------------------------------
125
   unsigned char ExternalControl;        // for serial Control
126
//------------------------------------------------
127
   unsigned char LoopConfig;             // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
128
   unsigned char ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
129
   unsigned char Reserved[4];
130
   char Name[12];
131
 };
132
 
133
 
134
/*
135
unsigned char ServoNickMax;           // Wert : 0-250
136
    unsigned char ServoNickRefresh;       //
137
    unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
138
    unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
139
//------------------------------------------------
140
    unsigned char LoopConfig;             // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
141
    unsigned char ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
142
    unsigned char Reserved[4];
143
    char Name[12];
144
*/
145
 
146
extern struct mk_param_struct EE_Parameter;
147
 
148
extern unsigned char Parameter_Luftdruck_D;
149
extern unsigned char Parameter_MaxHoehe;
150
extern unsigned char Parameter_Hoehe_P;
151
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
152
extern unsigned char Parameter_KompassWirkung;
153
extern unsigned char Parameter_Gyro_P;
154
extern unsigned char Parameter_Gyro_I;
155
extern unsigned char Parameter_Gier_P;
156
extern unsigned char Parameter_ServoNickControl;
157
extern unsigned char Parameter_AchsKopplung1;
158
extern unsigned char Parameter_AchsGegenKopplung1;
159
extern unsigned char Parameter_J16Bitmask;             // for the J16 Output
160
extern unsigned char Parameter_J16Timing;              // for the J16 Output
161
extern unsigned char Parameter_J17Bitmask;             // for the J17 Output
162
extern unsigned char Parameter_J17Timing;              // for the J17 Output
163
extern unsigned char Parameter_NaviGpsModeControl;     // Parameters for the Naviboard
164
extern unsigned char Parameter_NaviGpsGain;    
165
extern unsigned char Parameter_NaviGpsP;        
166
extern unsigned char Parameter_NaviGpsI;        
167
extern unsigned char Parameter_NaviGpsD;        
168
extern unsigned char Parameter_NaviGpsACC;        
169
#endif //_FC_H
170