Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2287 | - | 1 | /*####################################################################################### |
2 | Flight Control |
||
3 | #######################################################################################*/ |
||
4 | |||
5 | #ifndef _FC_H |
||
6 | #define _FC_H |
||
7 | //#define GIER_GRAD_FAKTOR 1291L // Abhängigkeit zwischen GyroIntegral und Winkel |
||
8 | //#define GIER_GRAD_FAKTOR 1160L |
||
9 | extern long GIER_GRAD_FAKTOR; // Abhängigkeit zwischen GyroIntegral und Winkel |
||
10 | #define STICK_GAIN 4 |
||
11 | #define ACC_AMPLIFY 6 |
||
12 | |||
13 | // FC_StatusFlags |
||
14 | #define FC_STATUS_MOTOR_RUN 0x01 |
||
15 | #define FC_STATUS_FLY 0x02 |
||
16 | #define FC_STATUS_CALIBRATE 0x04 |
||
17 | #define FC_STATUS_START 0x08 |
||
18 | #define FC_STATUS_EMERGENCY_LANDING 0x10 |
||
19 | #define FC_STATUS_LOWBAT 0x20 |
||
20 | #define FC_STATUS_VARIO_TRIM_UP 0x40 |
||
21 | #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
||
22 | |||
23 | // FC_StatusFlags2 |
||
24 | #define FC_STATUS2_CAREFREE 0x01 |
||
25 | #define FC_STATUS2_ALTITUDE_CONTROL 0x02 |
||
26 | #define FC_STATUS2_RC_FAILSAVE_ACTIVE 0x04 |
||
27 | #define FC_STATUS2_OUT1_ACTIVE 0x08 |
||
28 | #define FC_STATUS2_OUT2_ACTIVE 0x10 |
||
29 | |||
30 | //NC_To_FC_Flags |
||
31 | #define NC_TO_FC_FLYING_RANGE 0x01 |
||
32 | #define NC_TO_FC_EMERGENCY_LANDING 0x02 |
||
33 | |||
34 | extern volatile unsigned char FC_StatusFlags, FC_StatusFlags2; |
||
35 | extern void ParameterZuordnung(void); |
||
36 | |||
37 | #define Poti1 Poti[0] |
||
38 | #define Poti2 Poti[1] |
||
39 | #define Poti3 Poti[2] |
||
40 | #define Poti4 Poti[3] |
||
41 | #define Poti5 Poti[4] |
||
42 | #define Poti6 Poti[5] |
||
43 | #define Poti7 Poti[6] |
||
44 | #define Poti8 Poti[7] |
||
45 | |||
46 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
||
47 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
||
48 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
||
49 | |||
50 | #define CHK_POTI(b,a) {if(a < 248) b = a; else b = Poti[255 - a];} |
||
51 | #define CHK_POTI_OFF(b,a,off) {if(a < 248) b = a; else b = Poti[255 - a] - off;} |
||
52 | #define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max);} |
||
53 | #define CHK_POTI_MM_OFF(b,a,min,max,off) {CHK_POTI_OFF(b,a,off); LIMIT_MIN_MAX(b, min, max);} |
||
54 | |||
55 | extern unsigned char Sekunde,Minute; |
||
56 | extern unsigned int BaroExpandActive; |
||
57 | extern long IntegralNick,IntegralNick2; |
||
58 | extern long IntegralRoll,IntegralRoll2; |
||
59 | //extern int IntegralNick,IntegralNick2; |
||
60 | //extern int IntegralRoll,IntegralRoll2; |
||
61 | extern unsigned char Poti[9]; |
||
62 | |||
63 | extern long Mess_IntegralNick,Mess_IntegralNick2; |
||
64 | extern long Mess_IntegralRoll,Mess_IntegralRoll2; |
||
65 | extern long IntegralAccNick,IntegralAccRoll; |
||
66 | extern long SummeNick,SummeRoll; |
||
67 | extern volatile long Mess_Integral_Hoch; |
||
68 | extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
||
69 | extern int KompassValue; |
||
70 | extern int KompassSollWert; |
||
71 | extern int KompassRichtung; |
||
72 | extern char CalculateCompassTimer; |
||
73 | extern unsigned char KompassFusion; |
||
74 | extern unsigned char ControlHeading; |
||
75 | extern int TrimNick, TrimRoll; |
||
76 | extern long ErsatzKompass; |
||
77 | extern int ErsatzKompassInGrad; // Kompasswert in Grad |
||
78 | extern long HoehenWert; |
||
79 | extern long SollHoehe; |
||
80 | extern long FromNC_AltitudeSetpoint; |
||
81 | extern unsigned char FromNC_AltitudeSpeed; |
||
82 | extern unsigned char Parameter_HoehenSchalter; // Wert : 0-250 |
||
83 | extern unsigned char CareFree; |
||
84 | extern int MesswertNick,MesswertRoll,MesswertGier; |
||
85 | extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
||
86 | extern unsigned int NeutralAccX, NeutralAccY; |
||
87 | extern unsigned char HoehenReglerAktiv; |
||
88 | extern int NeutralAccZ; |
||
89 | extern long Umschlag180Nick, Umschlag180Roll; |
||
90 | extern signed int ExternStickNick,ExternStickRoll,ExternStickGier; |
||
91 | extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8; |
||
92 | extern int NaviAccNick,NaviAccRoll,NaviCntAcc; |
||
93 | extern unsigned int modell_fliegt; |
||
94 | extern void MotorRegler(void); |
||
95 | extern void SendMotorData(void); |
||
96 | //void CalibrierMittelwert(void); |
||
97 | //void Mittelwert(void); |
||
98 | extern void SetNeutral(unsigned char AccAdjustment); |
||
99 | extern void Piep(unsigned char Anzahl, unsigned int dauer); |
||
100 | extern void CopyDebugValues(void); |
||
101 | |||
102 | extern unsigned char h,m,s; |
||
103 | extern int StickNick,StickRoll,StickGier,StickGas; |
||
104 | extern volatile unsigned char Timeout ; |
||
105 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
106 | extern int DiffNick,DiffRoll; |
||
107 | //extern int Poti1, Poti2, Poti3, Poti4; |
||
108 | extern volatile unsigned char SenderOkay; |
||
109 | extern int StickNick,StickRoll,StickGier; |
||
110 | extern char MotorenEin; |
||
111 | extern unsigned char CalibrationDone; |
||
112 | extern unsigned char Parameter_Servo3,Parameter_Servo4,Parameter_Servo5; |
||
113 | extern char VarioCharacter; |
||
114 | extern signed int AltitudeSetpointTrimming; |
||
115 | extern signed char WaypointTrimming; |
||
116 | extern int HoverGas; |
||
117 | extern unsigned char Parameter_Luftdruck_D; |
||
118 | extern unsigned char Parameter_MaxHoehe; |
||
119 | extern unsigned char Parameter_Hoehe_P; |
||
120 | extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
||
121 | extern unsigned char Parameter_KompassWirkung; |
||
122 | extern unsigned char Parameter_Gyro_P; |
||
123 | extern unsigned char Parameter_Gyro_I; |
||
124 | extern unsigned char Parameter_Gier_P; |
||
125 | extern unsigned char Parameter_ServoNickControl; |
||
126 | extern unsigned char Parameter_ServoRollControl; |
||
127 | extern unsigned char Parameter_AchsKopplung1; |
||
128 | extern unsigned char Parameter_AchsKopplung2; |
||
129 | //extern unsigned char Parameter_AchsGegenKopplung1; |
||
130 | extern unsigned char Parameter_J16Bitmask; // for the J16 Output |
||
131 | extern unsigned char Parameter_J16Timing; // for the J16 Output |
||
132 | extern unsigned char Parameter_J17Bitmask; // for the J17 Output |
||
133 | extern unsigned char Parameter_J17Timing; // for the J17 Output |
||
134 | extern unsigned char Parameter_GlobalConfig; |
||
135 | extern unsigned char Parameter_ExtraConfig; |
||
136 | extern signed char MixerTable[MAX_MOTORS][4]; |
||
137 | extern const signed char sintab[31]; |
||
138 | #endif //_FC_H |
||
139 |