Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2751 | - | 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 | #define FC_STATUS2_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground |
||
30 | #define FC_STATUS2_AUTO_STARTING 0x40 |
||
31 | #define FC_STATUS2_AUTO_LANDING 0x80 |
||
32 | |||
33 | //NC_To_FC_Flags |
||
34 | #define NC_TO_FC_FLYING_RANGE 0x01 |
||
35 | #define NC_TO_FC_EMERGENCY_LANDING 0x02 |
||
36 | #define NC_TO_FC_AUTOSTART 0x04 |
||
37 | #define NC_TO_FC_AUTOLANDING 0x08 // not used |
||
38 | |||
39 | extern volatile unsigned char FC_StatusFlags, FC_StatusFlags2; |
||
40 | extern void ParameterZuordnung(void); |
||
41 | extern unsigned char GetChannelValue(unsigned char ch); // gives the unsigned value of the channel |
||
42 | |||
43 | #define Poti1 Poti[0] |
||
44 | #define Poti2 Poti[1] |
||
45 | #define Poti3 Poti[2] |
||
46 | #define Poti4 Poti[3] |
||
47 | #define Poti5 Poti[4] |
||
48 | #define Poti6 Poti[5] |
||
49 | #define Poti7 Poti[6] |
||
50 | #define Poti8 Poti[7] |
||
51 | |||
52 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
||
53 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
||
54 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
||
55 | |||
56 | #define CHK_POTI(b,a) {if(a < 248) b = a; else b = Poti[255 - a];} |
||
57 | #define CHK_POTI_OFF(b,a,off) {if(a < 248) b = a; else b = Poti[255 - a] - off;} |
||
58 | #define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max);} |
||
59 | #define CHK_POTI_MM_OFF(b,a,min,max,off) {CHK_POTI_OFF(b,a,off); LIMIT_MIN_MAX(b, min, max);} |
||
60 | |||
61 | extern unsigned char Sekunde,Minute; |
||
62 | extern unsigned int BaroExpandActive; |
||
63 | extern long IntegralNick,IntegralNick2; |
||
64 | extern long IntegralRoll,IntegralRoll2; |
||
65 | //extern int IntegralNick,IntegralNick2; |
||
66 | //extern int IntegralRoll,IntegralRoll2; |
||
67 | extern unsigned char Poti[9]; |
||
68 | |||
69 | extern long Mess_IntegralNick,Mess_IntegralNick2; |
||
70 | extern long Mess_IntegralRoll,Mess_IntegralRoll2; |
||
71 | extern long IntegralAccNick,IntegralAccRoll; |
||
72 | extern long SummeNick,SummeRoll; |
||
73 | extern volatile long Mess_Integral_Hoch; |
||
74 | extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
||
75 | extern int KompassValue; |
||
76 | extern int KompassSollWert; |
||
77 | extern int KompassRichtung; |
||
78 | extern char CalculateCompassTimer; |
||
79 | extern unsigned char KompassFusion; |
||
80 | extern unsigned char ControlHeading; |
||
81 | extern int TrimNick, TrimRoll; |
||
82 | extern long ErsatzKompass; |
||
83 | extern int ErsatzKompassInGrad; // Kompasswert in Grad |
||
84 | extern long HoehenWert; |
||
85 | extern long SollHoehe; |
||
86 | extern long FromNC_AltitudeSetpoint; |
||
87 | extern unsigned char FromNC_AltitudeSpeed; |
||
88 | extern unsigned char Parameter_HoehenSchalter; // Wert : 0-250 |
||
89 | extern unsigned char CareFree; |
||
90 | extern int MesswertNick,MesswertRoll,MesswertGier; |
||
91 | extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
||
92 | extern unsigned int NeutralAccX, NeutralAccY; |
||
93 | extern unsigned char HoehenReglerAktiv; |
||
94 | extern int NeutralAccZ; |
||
95 | extern signed char NeutralAccZfine; |
||
96 | extern long Umschlag180Nick, Umschlag180Roll; |
||
97 | extern signed int ExternStickNick,ExternStickRoll,ExternStickGier; |
||
98 | extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8; |
||
99 | extern int NaviAccNick,NaviAccRoll,NaviCntAcc; |
||
100 | extern unsigned int modell_fliegt; |
||
101 | extern void MotorRegler(void); |
||
102 | extern void SendMotorData(void); |
||
103 | //void CalibrierMittelwert(void); |
||
104 | //void Mittelwert(void); |
||
105 | extern unsigned char SetNeutral(unsigned char AccAdjustment); // retuns: "sucess" |
||
106 | extern void Piep(unsigned char Anzahl, unsigned int dauer); |
||
107 | extern void CopyDebugValues(void); |
||
108 | extern unsigned char ACC_AltitudeControl; |
||
109 | extern signed int CosAttitude; // for projection of hoover gas |
||
110 | |||
111 | extern unsigned char h,m,s; |
||
112 | extern int StickNick,StickRoll,StickGier,StickGas; |
||
113 | extern volatile unsigned char Timeout ; |
||
114 | extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
||
115 | extern int DiffNick,DiffRoll; |
||
116 | //extern int Poti1, Poti2, Poti3, Poti4; |
||
117 | extern volatile unsigned char SenderOkay; |
||
118 | extern int StickNick,StickRoll,StickGier; |
||
119 | extern char MotorenEin; |
||
120 | extern unsigned char CalibrationDone; |
||
121 | extern unsigned char Parameter_Servo3,Parameter_Servo4,Parameter_Servo5; |
||
122 | extern char VarioCharacter; |
||
123 | extern signed int AltitudeSetpointTrimming; |
||
124 | extern signed char WaypointTrimming; |
||
125 | extern int HoverGas; |
||
126 | extern unsigned char Parameter_Luftdruck_D; |
||
127 | //extern unsigned char Parameter_MaxHoehe; |
||
128 | extern unsigned char Parameter_Hoehe_P; |
||
129 | extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
||
130 | extern unsigned char Parameter_KompassWirkung; |
||
131 | extern unsigned char Parameter_Gyro_P; |
||
132 | extern unsigned char Parameter_Gyro_I; |
||
133 | extern unsigned char Parameter_Gier_P; |
||
134 | extern unsigned char Parameter_ServoNickControl; |
||
135 | extern unsigned char Parameter_ServoRollControl; |
||
136 | extern unsigned char Parameter_ServoNickComp; |
||
137 | extern unsigned char Parameter_ServoRollComp; |
||
138 | extern unsigned char Parameter_AchsKopplung1; |
||
139 | extern unsigned char Parameter_AchsKopplung2; |
||
140 | //extern unsigned char Parameter_AchsGegenKopplung1; |
||
141 | extern unsigned char Parameter_J16Bitmask; // for the J16 Output |
||
142 | extern unsigned char Parameter_J16Timing; // for the J16 Output |
||
143 | extern unsigned char Parameter_J17Bitmask; // for the J17 Output |
||
144 | extern unsigned char Parameter_J17Timing; // for the J17 Output |
||
145 | extern unsigned char Parameter_GlobalConfig; |
||
146 | extern unsigned char Parameter_ExtraConfig; |
||
147 | extern signed char MixerTable[MAX_MOTORS][4]; |
||
148 | extern const signed char sintab[31]; |
||
149 | #endif //_FC_H |
||
150 |