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