Subversion Repositories FlightCtrl

Rev

Rev 1096 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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