Rev 1 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 173 | ||
---|---|---|---|
1 | /*####################################################################################### |
1 | /*####################################################################################### |
2 | Flight Control |
2 | Flight Control |
3 | #######################################################################################*/ |
3 | #######################################################################################*/ |
4 | 4 | ||
5 | #ifndef _FC_H |
5 | #ifndef _FC_H |
6 | #define _FC_H |
6 | #define _FC_H |
7 | 7 | ||
8 | extern volatile unsigned char Timeout; |
8 | extern volatile unsigned int I2CTimeout; |
9 | extern unsigned char Sekunde,Minute; |
9 | extern unsigned char Sekunde,Minute; |
10 | extern volatile long IntegralNick,IntegralNick2; |
10 | extern volatile long IntegralNick,IntegralNick2; |
11 | extern volatile long IntegralRoll,IntegralRoll2; |
11 | extern volatile long IntegralRoll,IntegralRoll2; |
12 | extern volatile long Mess_IntegralNick,Mess_IntegralNick2; |
12 | extern volatile long Mess_IntegralNick,Mess_IntegralNick2; |
13 | extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
13 | extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
14 | extern volatile long Mess_Integral_Hoch; |
14 | extern volatile long Mess_Integral_Hoch; |
15 | extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
15 | extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
16 | extern volatile int KompassValue; |
16 | extern volatile int KompassValue; |
17 | extern volatile int KompassStartwert; |
17 | extern volatile int KompassStartwert; |
18 | extern volatile int KompassRichtung; |
18 | extern volatile int KompassRichtung; |
19 | extern int HoehenWert; |
19 | extern int HoehenWert; |
20 | extern int SollHoehe; |
20 | extern int SollHoehe; |
21 | extern volatile int MesswertNick,MesswertRoll,MesswertGier; |
21 | extern volatile int MesswertNick,MesswertRoll,MesswertGier; |
22 | extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
22 | extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
23 | extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch; |
23 | extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch; |
24 | extern volatile float NeutralAccZ; |
24 | extern volatile float NeutralAccZ; |
25 | 25 | ||
26 | 26 | ||
27 | void MotorRegler(void); |
27 | void MotorRegler(void); |
28 | void SendMotorData(void); |
28 | void SendMotorData(void); |
29 | void CalibrierMittelwert(void); |
29 | void CalibrierMittelwert(void); |
30 | void Mittelwert(void); |
30 | void Mittelwert(void); |
31 | void SetNeutral(void); |
31 | void SetNeutral(void); |
32 | 32 | ||
33 | unsigned char h,m,s; |
33 | unsigned char h,m,s; |
34 | volatile unsigned char Timeout ; |
34 | volatile unsigned char Timeout ; |
35 | unsigned char CosinusNickWinkel, CosinusRollWinkel; |
35 | unsigned char CosinusNickWinkel, CosinusRollWinkel; |
36 | volatile long IntegralNick,IntegralNick2; |
36 | volatile long IntegralNick,IntegralNick2; |
37 | volatile long IntegralRoll,IntegralRoll2; |
37 | volatile long IntegralRoll,IntegralRoll2; |
38 | volatile long Integral_Gier; |
38 | volatile long Integral_Gier; |
39 | volatile long Mess_IntegralNick,Mess_IntegralNick2; |
39 | volatile long Mess_IntegralNick,Mess_IntegralNick2; |
40 | volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
40 | volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
41 | volatile long Mess_Integral_Gier; |
41 | volatile long Mess_Integral_Gier; |
42 | volatile int DiffNick,DiffRoll; |
42 | volatile int DiffNick,DiffRoll; |
43 | extern int Poti1, Poti2, Poti3, Poti4; |
43 | extern int Poti1, Poti2, Poti3, Poti4; |
44 | volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
44 | volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
45 | unsigned char MotorWert[5]; |
45 | unsigned char MotorWert[5]; |
46 | volatile unsigned char SenderOkay; |
46 | volatile unsigned char SenderOkay; |
47 | int StickNick,StickRoll,StickGier; |
47 | int StickNick,StickRoll,StickGier; |
48 | char MotorenEin; |
48 | char MotorenEin; |
49 | extern void DefaultKonstanten(void); |
49 | extern void DefaultKonstanten(void); |
50 | 50 | ||
51 | #define STRUCT_PARAM_LAENGE 58 |
51 | #define STRUCT_PARAM_LAENGE 58 |
52 | struct mk_param_struct |
52 | struct mk_param_struct |
53 | { |
53 | { |
54 | unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
54 | unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
55 | unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
55 | unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
56 | unsigned char Hoehe_MinGas; // Wert : 0-100 |
56 | unsigned char Hoehe_MinGas; // Wert : 0-100 |
57 | unsigned char Luftdruck_D; // Wert : 0-250 |
57 | unsigned char Luftdruck_D; // Wert : 0-250 |
58 | unsigned char MaxHoehe; // Wert : 0-32 |
58 | unsigned char MaxHoehe; // Wert : 0-32 |
59 | unsigned char Hoehe_P; // Wert : 0-32 |
59 | unsigned char Hoehe_P; // Wert : 0-32 |
60 | unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
60 | unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
61 | unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
61 | unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
62 | unsigned char Stick_P; // Wert : 1-6 |
62 | unsigned char Stick_P; // Wert : 1-6 |
63 | unsigned char Stick_D; // Wert : 0-64 |
63 | unsigned char Stick_D; // Wert : 0-64 |
64 | unsigned char Gier_P; // Wert : 1-20 |
64 | unsigned char Gier_P; // Wert : 1-20 |
65 | unsigned char Gas_Min; // Wert : 0-32 |
65 | unsigned char Gas_Min; // Wert : 0-32 |
66 | unsigned char Gas_Max; // Wert : 33-250 |
66 | unsigned char Gas_Max; // Wert : 33-250 |
67 | unsigned char GyroAccFaktor; // Wert : 1-64 |
67 | unsigned char GyroAccFaktor; // Wert : 1-64 |
68 | unsigned char KompassWirkung; // Wert : 0-32 |
68 | unsigned char KompassWirkung; // Wert : 0-32 |
69 | unsigned char Gyro_P; // Wert : 10-250 |
69 | unsigned char Gyro_P; // Wert : 10-250 |
70 | unsigned char Gyro_I; // Wert : 0-250 |
70 | unsigned char Gyro_I; // Wert : 0-250 |
71 | unsigned char UnterspannungsWarnung; // Wert : 0-250 |
71 | unsigned char UnterspannungsWarnung; // Wert : 0-250 |
72 | unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
72 | unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
73 | unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
73 | unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
74 | unsigned char UfoAusrichtung; // X oder + Formation |
74 | unsigned char UfoAusrichtung; // X oder + Formation |
75 | unsigned char I_Faktor; // Wert : 0-250 |
75 | unsigned char I_Faktor; // Wert : 0-250 |
76 | unsigned char UserParam1; // Wert : 0-250 |
76 | unsigned char UserParam1; // Wert : 0-250 |
77 | unsigned char UserParam2; // Wert : 0-250 |
77 | unsigned char UserParam2; // Wert : 0-250 |
78 | unsigned char UserParam3; // Wert : 0-250 |
78 | unsigned char UserParam3; // Wert : 0-250 |
79 | unsigned char UserParam4; // Wert : 0-250 |
79 | unsigned char UserParam4; // Wert : 0-250 |
80 | unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
80 | unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
81 | unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
81 | unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
82 | unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
82 | unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
83 | unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
83 | unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
- | 84 | unsigned char ServoNickRefresh; // |
|
- | 85 | unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
|
84 | unsigned char ServoNickRefresh; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
86 | unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
- | 87 | //------------------------------------------------ |
|
- | 88 | unsigned char LoopConfig; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
|
85 | unsigned char ServoNickCompInvert; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
89 | unsigned char ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
86 | unsigned char Reserved[7]; |
90 | unsigned char Reserved[4]; |
87 | char Name[12]; |
91 | char Name[12]; |
88 | }; |
92 | }; |
89 | 93 | ||
- | 94 | /* |
|
- | 95 | unsigned char ServoNickMax; // Wert : 0-250 |
|
- | 96 | unsigned char ServoNickRefresh; // |
|
- | 97 | unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
|
- | 98 | unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
|
- | 99 | //------------------------------------------------ |
|
- | 100 | unsigned char LoopConfig; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
|
- | 101 | unsigned char ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
|
- | 102 | unsigned char Reserved[4]; |
|
90 | 103 | char Name[12]; |
|
91 | 104 | */ |
|
92 | 105 | ||
93 | extern struct mk_param_struct EE_Parameter; |
106 | extern struct mk_param_struct EE_Parameter; |
94 | 107 | ||
95 | extern unsigned char Parameter_Luftdruck_D; |
108 | extern unsigned char Parameter_Luftdruck_D; |
96 | extern unsigned char Parameter_MaxHoehe; |
109 | extern unsigned char Parameter_MaxHoehe; |
97 | extern unsigned char Parameter_Hoehe_P; |
110 | extern unsigned char Parameter_Hoehe_P; |
98 | extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
111 | extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
99 | extern unsigned char Parameter_KompassWirkung; |
112 | extern unsigned char Parameter_KompassWirkung; |
100 | extern unsigned char Parameter_Gyro_P; |
113 | extern unsigned char Parameter_Gyro_P; |
101 | extern unsigned char Parameter_Gyro_I; |
114 | extern unsigned char Parameter_Gyro_I; |
102 | extern unsigned char Parameter_Gier_P; |
115 | extern unsigned char Parameter_Gier_P; |
103 | extern unsigned char Parameter_ServoNickControl; |
116 | extern unsigned char Parameter_ServoNickControl; |
104 | 117 | ||
105 | #endif //_FC_H |
118 | #endif //_FC_H |
106 | 119 | ||
107 | 120 |