Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2248 | - | 1 | /***************************************************************************************************************************** |
2 | * File: fc.h |
||
3 | * Purpose: header of fc.c |
||
4 | *****************************************************************************************************************************/ |
||
5 | #ifndef _FC_H |
||
6 | #define _FC_H |
||
7 | |||
8 | // ---------------------- definitions ---------------------- |
||
9 | #define STICK_GAIN 4 |
||
10 | |||
11 | #define FLAG_MOTOR_RUN 1 // diese Flags werden |
||
12 | #define FLAG_FLY 2 // bei Bedarf |
||
13 | #define FLAG_CALIBRATE 4 // auf die |
||
14 | #define FLAG_START 8 // Variable |
||
15 | #define FLAG_NOTLANDUNG 16 // "MikroKopterFlags" |
||
16 | #define FLAG_LOWBAT 32 // abgebildet |
||
17 | |||
18 | #define MAX_MOTORS 2 // gesetzt für Waage (max 12 möglich) |
||
19 | #define CHECK_MIN_MAX(wert,min,max) {if(wert < min) wert = min; else if(wert > max) wert = max;} |
||
20 | |||
21 | extern long GIER_GRAD_FAKTOR; // Abhängigkeit zwischen GyroIntegral und Winkel |
||
22 | extern volatile unsigned char MikroKopterFlags; |
||
23 | extern volatile unsigned int I2CTimeout; |
||
24 | extern unsigned char Sekunde,Minute; |
||
25 | extern unsigned int BaroExpandActive; |
||
26 | extern long IntegralNick,IntegralNick2; |
||
27 | extern long IntegralRoll,IntegralRoll2; |
||
28 | |||
29 | extern long Mess_IntegralNick,Mess_IntegralNick2; |
||
30 | extern long Mess_IntegralRoll,Mess_IntegralRoll2; |
||
31 | extern long IntegralAccNick,IntegralAccRoll; |
||
32 | extern volatile long Mess_Integral_Hoch; |
||
33 | extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
||
34 | extern int KompassValue; |
||
35 | extern int KompassStartwert; |
||
36 | extern int KompassRichtung; |
||
37 | |||
38 | extern int TrimNick, TrimRoll; |
||
39 | extern long ErsatzKompass; |
||
40 | extern int ErsatzKompassInGrad; // Kompasswert in Grad |
||
41 | extern long HoehenWert; |
||
42 | extern long SollHoehe; |
||
43 | extern int MesswertNick,MesswertRoll,MesswertGier; |
||
44 | extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
||
45 | extern int NeutralAccX, NeutralAccY,Mittelwert_AccHoch; |
||
46 | extern unsigned char HoehenReglerAktiv; |
||
47 | extern volatile float NeutralAccZ; |
||
48 | extern long Umschlag180Nick, Umschlag180Roll; |
||
49 | extern signed int ExternStickNick,ExternStickRoll,ExternStickGier; |
||
50 | |||
51 | extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8; |
||
52 | extern int NaviAccNick,NaviAccRoll,NaviCntAcc; |
||
53 | extern unsigned int modell_fliegt; |
||
54 | |||
55 | //------------------------- functions --------------- |
||
56 | void MotorRegler(void); |
||
57 | void SendMotorData(void); |
||
58 | void CalibrierMittelwert(void); |
||
59 | void Mittelwert(void); |
||
60 | void SetNeutral(void); |
||
61 | void Piep(unsigned char Anzahl, unsigned int dauer); |
||
62 | |||
63 | extern unsigned char h,m,s; |
||
64 | extern volatile unsigned char Timeout ; |
||
65 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
66 | extern int DiffNick,DiffRoll; |
||
67 | extern int Poti1, Poti2, Poti3, Poti4; |
||
68 | extern volatile unsigned char SenderOkay; |
||
69 | extern volatile unsigned char SenderRSSI; |
||
70 | extern unsigned char RequiredMotors; |
||
71 | extern int StickNick,StickRoll,StickGier; |
||
72 | extern char MotorenEin; |
||
73 | |||
74 | extern void DefaultKonstanten1(void); |
||
75 | extern void DefaultKonstanten2(void); |
||
76 | extern void DefaultKonstanten3(void); |
||
77 | extern void DefaultStickMapping(void); |
||
78 | |||
79 | |||
80 | #define STRUCT_PARAM_LAENGE sizeof(EE_Parameter) |
||
81 | |||
82 | struct mk_param_struct |
||
83 | { |
||
84 | unsigned char Kanalbelegung[8]; // 01-08 Nick[0]=3, Roll[1]=2,Gas[2]=1, Gier[3]=4, K_POTI1[4], K_POTI2[5], K_POTI3[6], K_POTI4[7] steht auf EEPROM auf Adresse 80-87 |
||
85 | unsigned char GlobalConfig; // 09 0x80=Rotationrate Limiter, 0x40=ACHSENKOPPLUNG_AKTIV, 0x20=GPS aktiv, 0x10=Orientation fix, 0x08=Kompass_aktiv, 0x04=Heading Hold aktiv, 0x02=?, 0x01=Höhenregler aktiv |
||
86 | unsigned char Hoehe_MinGas; // 10 Wert : 0-100 |
||
87 | unsigned char Luftdruck_D; // 11 Wert : 0-250 |
||
88 | unsigned char MaxHoehe; // 12 Wert : 0-32 |
||
89 | unsigned char Hoehe_P; // 13 Wert : 0-32 |
||
90 | unsigned char Hoehe_Verstaerkung; // 14 Wert : 0-50 |
||
91 | unsigned char Hoehe_ACC_Wirkung; // 15 Wert : 0-250 |
||
92 | unsigned char Hoehe_HoverBand; // 16 Wert : 0-250 |
||
93 | unsigned char Hoehe_GPS_Z; // 17 Wert : 0-250 |
||
94 | unsigned char Hoehe_StickNeutralPoint; // 18 Wert : 0-250 |
||
95 | unsigned char Stick_P; // 19 Wert : 1-6 |
||
96 | unsigned char Stick_D; // 20 Wert : 0-64 |
||
97 | unsigned char Gier_P; // 21 Wert : 1-20 |
||
98 | unsigned char Gas_Min; // 22 Wert : 0-32 |
||
99 | unsigned char Gas_Max; // 23 Wert : 33-250 |
||
100 | unsigned char GyroAccFaktor; // 24 Wert : 1-64 |
||
101 | unsigned char KompassWirkung; // 25 Wert : 0-32 |
||
102 | unsigned char Gyro_P; // 26 Wert : 10-250 |
||
103 | unsigned char Gyro_I; // 27 Wert : 0-250 |
||
104 | unsigned char Gyro_D; // 28 Wert : 0-250 |
||
105 | unsigned char Gyro_Gier_P; // 29 Wert : 10-250 |
||
106 | unsigned char Gyro_Gier_I; // 30 Wert : 0-250 |
||
107 | unsigned char UnterspannungsWarnung; // 31 Wert : 0-250 |
||
108 | unsigned char NotGas; // 32 Wert : 0-250 // Gaswert bei Empangsverlust |
||
109 | unsigned char NotGasZeit; // 33 Wert : 0-250 // Zeit, bis auf NotGas geschaltet wird, wegen Empfänger-Problemen |
||
110 | unsigned char UfoAusrichtung; // 34 X oder + Formation |
||
111 | unsigned char I_Faktor; // 35 Wert : 0-250 |
||
112 | unsigned char UserParam1; // 36 Wert : 0-250 |
||
113 | unsigned char UserParam2; // 37 Wert : 0-250 |
||
114 | unsigned char UserParam3; // 38 Wert : 0-250 |
||
115 | unsigned char UserParam4; // 39 Wert : 0-250 |
||
116 | unsigned char ServoNickControl; // 40 Wert : 0-250 // Stellung des Servos |
||
117 | unsigned char ServoNickComp; // 41 Wert : 0-250 // Einfluss Gyro/Servo |
||
118 | unsigned char ServoNickMin; // 42 Wert : 0-250 // Anschlag |
||
119 | unsigned char ServoNickMax; // 43 Wert : 0-250 // Anschlag |
||
120 | //---------------------------------- // --------------------- Seit V0.75 ------------------------------------- |
||
121 | unsigned char ServoRollControl; // 44 Wert : 0-250 // Stellung des Servos |
||
122 | unsigned char ServoRollComp; // 45 Wert : 0-250 |
||
123 | unsigned char ServoRollMin; // 46 Wert : 0-250 |
||
124 | unsigned char ServoRollMax; // 47 Wert : 0-250 |
||
125 | unsigned char ServoNickRefresh; // 48 |
||
126 | unsigned char LoopGasLimit; // 49 Wert: 0-250 max. Gas während Looping |
||
127 | unsigned char LoopThreshold; // 50 Wert: 0-250 Schwelle für Stickausschlag |
||
128 | unsigned char LoopHysterese; // 51 Wert: 0-250 Hysterese für Stickausschlag |
||
129 | unsigned char AchsKopplung1; // 52 Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
||
130 | unsigned char AchsKopplung2; // 53 Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
131 | unsigned char CouplingYawCorrection; // 54 Wert: 0-250 Faktor, mit dem Nick und Roll verkoppelt werden |
||
132 | unsigned char WinkelUmschlagNick; // 55 Wert: 0-250 180°-Punkt // EE_Parameter.WinkelUmschlagNick = 85; // TurnOverNick |
||
133 | unsigned char WinkelUmschlagRoll; // 56 Wert: 0-250 180°-Punkt // EE_Parameter.WinkelUmschlagRoll = 85; // TurnOverRoll |
||
134 | unsigned char GyroAccAbgleich; // 57 1/k (Koppel_ACC_Wirkung) |
||
135 | unsigned char Driftkomp; // 58 |
||
136 | unsigned char DynamicStability; // 59 |
||
137 | unsigned char UserParam5; // 60 Wert : 0-250 |
||
138 | unsigned char UserParam6; // 61 Wert : 0-250 |
||
139 | unsigned char UserParam7; // 62 Wert : 0-250 |
||
140 | unsigned char UserParam8; // 63 Wert : 0-250 |
||
141 | //----------------------------------- // ---------------------- Output ----------------------------------------- |
||
142 | unsigned char J16Bitmask; // 64 for the J16 Output |
||
143 | unsigned char J16Timing; // 65 for the J16 Output |
||
144 | unsigned char J17Bitmask; // 66 for the J17 Output |
||
145 | unsigned char J17Timing; // 67 for the J17 Output |
||
146 | // ---------------------------------- // ---------------------- seit version V0.75c ---------------------------- |
||
147 | unsigned char WARN_J16_Bitmask; // 68 for the J16 Output |
||
148 | unsigned char WARN_J17_Bitmask; // 69 for the J17 Output |
||
149 | //----------------------------------- // ------------NaviCtrl---------------------------------------------------- |
||
150 | unsigned char NaviGpsModeControl; // 70 Parameter für das Naviboard |
||
151 | unsigned char NaviGpsGain; // 71 |
||
152 | unsigned char NaviGpsP; // 72 |
||
153 | unsigned char NaviGpsI; // 73 |
||
154 | unsigned char NaviGpsD; // 74 |
||
155 | unsigned char NaviGpsPLimit; // 75 |
||
156 | unsigned char NaviGpsILimit; // 76 |
||
157 | unsigned char NaviGpsDLimit; // 77 |
||
158 | unsigned char NaviGpsACC; // 78 |
||
159 | unsigned char NaviGpsMinSat; // 79 |
||
160 | unsigned char NaviStickThreshold; // 80 |
||
161 | unsigned char NaviWindCorrection; // 81 |
||
162 | unsigned char NaviSpeedCompensation; // 82 |
||
163 | unsigned char NaviOperatingRadius; // 83 |
||
164 | unsigned char NaviAngleLimitation; // 84 |
||
165 | unsigned char NaviPH_LoginTime; // 85 |
||
166 | //---------------------------------- // ---Ext.Ctrl------------- |
||
167 | unsigned char ExternalControl; // 86 for serial Control |
||
168 | unsigned char BitConfig; // 87 (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
||
169 | unsigned char ServoCompInvert; // 88 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
||
170 | unsigned char ExtraConfig; // 89 bitcodiert |
||
171 | char Name[12]; // 90-101 |
||
172 | }; |
||
173 | //-------------------------------------------------------------------------------------------------------------------------------------------------- |
||
174 | extern struct mk_param_struct EE_Parameter; // ist in fc.c Zeile 112 deklariert worden |
||
175 | //-------------------------------------------------------------------------------------------------------------------------------------------------- |
||
176 | |||
177 | |||
178 | |||
179 | //---------------------------------------------------------------------------------------------------------------------- |
||
180 | struct |
||
181 | { |
||
182 | char Revision; // 1 |
||
183 | char Name[12]; // 2-13 siehe main.c Zeile 229 memcpy(Mixer.Name, "Quadro\0", 11); |
||
184 | signed char Motor[16][4]; // 14-77 für jeden Motor gibt es einen 4er Datensatz |
||
185 | } Mixer; |
||
186 | //---------------------------------------------------------------------------------------------------------------------- |
||
187 | |||
188 | |||
189 | |||
190 | |||
191 | extern unsigned char Parameter_Luftdruck_D; |
||
192 | extern unsigned char Parameter_MaxHoehe; |
||
193 | extern unsigned char Parameter_Hoehe_P; |
||
194 | extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
||
195 | extern unsigned char Parameter_KompassWirkung; |
||
196 | extern unsigned char Parameter_Gyro_P; |
||
197 | extern unsigned char Parameter_Gyro_I; |
||
198 | extern unsigned char Parameter_Gier_P; |
||
199 | extern unsigned char Parameter_ServoNickControl; |
||
200 | extern unsigned char Parameter_ServoRollControl; |
||
201 | extern unsigned char Parameter_AchsKopplung1; |
||
202 | extern unsigned char Parameter_AchsKopplung2; |
||
203 | |||
204 | extern unsigned char Parameter_J16Bitmask; // for the J16 Output |
||
205 | extern unsigned char Parameter_J16Timing; // for the J16 Output |
||
206 | extern unsigned char Parameter_J17Bitmask; // for the J17 Output |
||
207 | extern unsigned char Parameter_J17Timing; // for the J17 Output |
||
208 | extern signed char MixerTable[MAX_MOTORS][4]; |
||
209 | extern unsigned char Motor[MAX_MOTORS]; |
||
210 | |||
211 | #endif |
||
212 | // *** EOF: _FC_H ******************************************************************************************************************** |