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