Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
/*#######################################################################################
2
Flight Control
3
#######################################################################################*/
4
 
5
#ifndef _FC_H
6
#define _FC_H
1111 hbuss 7
//#define GIER_GRAD_FAKTOR 1291L // Abhängigkeit zwischen GyroIntegral und Winkel
1243 killagreg 8
//#define GIER_GRAD_FAKTOR 1160L
1121 hbuss 9
extern long GIER_GRAD_FAKTOR; // Abhängigkeit zwischen GyroIntegral und Winkel
855 hbuss 10
#define STICK_GAIN 4
1703 holgerb 11
#define ACC_AMPLIFY    6
2390 holgerb 12
#define HEIGHT_CONTROL_STICKTHRESHOLD 15
921 hbuss 13
 
1916 holgerb 14
// FC_StatusFlags
1765 killagreg 15
#define FC_STATUS_MOTOR_RUN                             0x01
16
#define FC_STATUS_FLY                                   0x02
17
#define FC_STATUS_CALIBRATE                             0x04
18
#define FC_STATUS_START                                 0x08
19
#define FC_STATUS_EMERGENCY_LANDING             0x10
20
#define FC_STATUS_LOWBAT                                0x20
1767 killagreg 21
#define FC_STATUS_VARIO_TRIM_UP                 0x40
22
#define FC_STATUS_VARIO_TRIM_DOWN               0x80
1254 killagreg 23
 
2040 holgerb 24
// FC_StatusFlags2 
1861 holgerb 25
#define FC_STATUS2_CAREFREE                 0x01
26
#define FC_STATUS2_ALTITUDE_CONTROL         0x02
1916 holgerb 27
#define FC_STATUS2_RC_FAILSAVE_ACTIVE       0x04
2040 holgerb 28
#define FC_STATUS2_OUT1_ACTIVE                  0x08
29
#define FC_STATUS2_OUT2_ACTIVE                  0x10
2309 holgerb 30
#define FC_STATUS2_WAIT_FOR_TAKEOFF             0x20   // Motor Running, but still on the ground
2340 holgerb 31
#define FC_STATUS2_AUTO_STARTING                0x40
32
#define FC_STATUS2_AUTO_LANDING                 0x80
1702 holgerb 33
 
2009 holgerb 34
//NC_To_FC_Flags
35
#define NC_TO_FC_FLYING_RANGE           0x01
36
#define NC_TO_FC_EMERGENCY_LANDING      0x02
2322 holgerb 37
#define NC_TO_FC_AUTOSTART                      0x04
38
#define NC_TO_FC_AUTOLANDING            0x08 // not used 
2009 holgerb 39
 
1861 holgerb 40
extern volatile unsigned char FC_StatusFlags, FC_StatusFlags2;
1862 holgerb 41
extern void ParameterZuordnung(void);
2342 holgerb 42
extern unsigned char GetChannelValue(unsigned char ch); // gives the unsigned value of the channel
1861 holgerb 43
 
1377 hbuss 44
#define Poti1 Poti[0]
45
#define Poti2 Poti[1]
46
#define Poti3 Poti[2]
47
#define Poti4 Poti[3]
48
#define Poti5 Poti[4]
49
#define Poti6 Poti[5]
50
#define Poti7 Poti[6]
51
#define Poti8 Poti[7]
1254 killagreg 52
 
2191 holgerb 53
#define LIMIT_MIN(value, min) {if(value <= min) value = min;}
54
#define LIMIT_MAX(value, max) {if(value >= max) value = max;}
55
#define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;}
56
 
1921 holgerb 57
#define CHK_POTI(b,a) {if(a < 248) b = a; else b = Poti[255 - a];}
1933 holgerb 58
#define CHK_POTI_OFF(b,a,off) {if(a < 248) b = a; else b = Poti[255 - a] - off;}
1921 holgerb 59
#define CHK_POTI_MM(b,a,min,max) {CHK_POTI(b,a); LIMIT_MIN_MAX(b, min, max);}
1933 holgerb 60
#define CHK_POTI_MM_OFF(b,a,min,max,off) {CHK_POTI_OFF(b,a,off); LIMIT_MIN_MAX(b, min, max);}
1921 holgerb 61
 
1 ingob 62
extern unsigned char Sekunde,Minute;
1352 hbuss 63
extern unsigned int BaroExpandActive;
693 hbuss 64
extern long IntegralNick,IntegralNick2;
65
extern long IntegralRoll,IntegralRoll2;
1153 hbuss 66
//extern int IntegralNick,IntegralNick2;
67
//extern int IntegralRoll,IntegralRoll2;
1420 killagreg 68
extern unsigned char Poti[9];
1153 hbuss 69
 
693 hbuss 70
extern long Mess_IntegralNick,Mess_IntegralNick2;
71
extern long Mess_IntegralRoll,Mess_IntegralRoll2;
72
extern long IntegralAccNick,IntegralAccRoll;
1685 holgerb 73
extern long SummeNick,SummeRoll;
1 ingob 74
extern volatile long Mess_Integral_Hoch;
693 hbuss 75
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
1153 hbuss 76
extern int  KompassValue;
1837 holgerb 77
extern int  KompassSollWert;
1153 hbuss 78
extern int  KompassRichtung;
1839 holgerb 79
extern char CalculateCompassTimer;
80
extern unsigned char KompassFusion;
1664 holgerb 81
extern unsigned char ControlHeading;
1166 hbuss 82
extern int  TrimNick, TrimRoll;
717 hbuss 83
extern long  ErsatzKompass;
2437 holgerb 84
extern int   ErsatzKompassInGrad,CompassCorrected; // Kompasswert in Grad
1246 killagreg 85
extern long HoehenWert;
86
extern long SollHoehe;
1855 holgerb 87
extern long FromNC_AltitudeSetpoint;
88
extern unsigned char FromNC_AltitudeSpeed;
1921 holgerb 89
extern unsigned char Parameter_HoehenSchalter;      // Wert : 0-250
1690 holgerb 90
extern unsigned char CareFree;
1153 hbuss 91
extern int MesswertNick,MesswertRoll,MesswertGier;
1703 holgerb 92
extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
1643 holgerb 93
extern unsigned int NeutralAccX, NeutralAccY;
1215 hbuss 94
extern unsigned char HoehenReglerAktiv;
1639 holgerb 95
extern int NeutralAccZ;
2316 holgerb 96
extern signed char NeutralAccZfine;
396 hbuss 97
extern long Umschlag180Nick, Umschlag180Roll;
492 hbuss 98
extern signed int ExternStickNick,ExternStickRoll,ExternStickGier;
513 hbuss 99
extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8;
805 hbuss 100
extern int NaviAccNick,NaviAccRoll,NaviCntAcc;
871 hbuss 101
extern unsigned int modell_fliegt;
1639 holgerb 102
extern void MotorRegler(void);
103
extern void SendMotorData(void);
1622 killagreg 104
//void CalibrierMittelwert(void);
105
//void Mittelwert(void);
2316 holgerb 106
extern unsigned char SetNeutral(unsigned char AccAdjustment);  // retuns: "sucess"
1639 holgerb 107
extern void Piep(unsigned char Anzahl, unsigned int dauer);
108
extern void CopyDebugValues(void);
2309 holgerb 109
extern unsigned char ACC_AltitudeControl;
110
extern signed int CosAttitude;  // for projection of hoover gas
1 ingob 111
 
304 ingob 112
extern unsigned char h,m,s;
1943 holgerb 113
extern int StickNick,StickRoll,StickGier,StickGas;
304 ingob 114
extern volatile unsigned char Timeout ;
115
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
1153 hbuss 116
extern int  DiffNick,DiffRoll;
1377 hbuss 117
//extern int  Poti1, Poti2, Poti3, Poti4;
304 ingob 118
extern volatile unsigned char SenderOkay;
119
extern int StickNick,StickRoll,StickGier;
120
extern char MotorenEin;
2009 holgerb 121
extern unsigned char CalibrationDone;
1403 hbuss 122
extern unsigned char Parameter_Servo3,Parameter_Servo4,Parameter_Servo5;
1591 holgerb 123
extern char VarioCharacter;
1942 holgerb 124
extern signed int AltitudeSetpointTrimming;
125
extern signed char WaypointTrimming;
1692 holgerb 126
extern int HoverGas;
1 ingob 127
extern unsigned char Parameter_Luftdruck_D;
2342 holgerb 128
//extern unsigned char Parameter_MaxHoehe;
1 ingob 129
extern unsigned char Parameter_Hoehe_P;
130
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
131
extern unsigned char Parameter_KompassWirkung;
132
extern unsigned char Parameter_Gyro_P;
133
extern unsigned char Parameter_Gyro_I;
134
extern unsigned char Parameter_Gier_P;
135
extern unsigned char Parameter_ServoNickControl;
1232 hbuss 136
extern unsigned char Parameter_ServoRollControl;
2296 holgerb 137
extern unsigned char Parameter_ServoNickComp;
138
extern unsigned char Parameter_ServoRollComp;
396 hbuss 139
extern unsigned char Parameter_AchsKopplung1;
1120 hbuss 140
extern unsigned char Parameter_AchsKopplung2;
141
//extern unsigned char Parameter_AchsGegenKopplung1;
921 hbuss 142
extern unsigned char Parameter_J16Bitmask;             // for the J16 Output
143
extern unsigned char Parameter_J16Timing;              // for the J16 Output
144
extern unsigned char Parameter_J17Bitmask;             // for the J17 Output
145
extern unsigned char Parameter_J17Timing;              // for the J17 Output
1916 holgerb 146
extern unsigned char Parameter_GlobalConfig;
147
extern unsigned char Parameter_ExtraConfig;
1243 killagreg 148
extern signed char MixerTable[MAX_MOTORS][4];
1760 holgerb 149
extern const signed char sintab[31];
2390 holgerb 150
extern unsigned char LowVoltageLandingActive;
2408 holgerb 151
extern unsigned char LowVoltageHomeActive;
2447 holgerb 152
extern unsigned char Parameter_MaximumAltitude;
1 ingob 153
#endif //_FC_H
154