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