Subversion Repositories FlightCtrl

Rev

Rev 122 | Go to most recent revision | Details | Compare with Previous | 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
7
 
117 salvo 8
//Salvo 1.9.2007 Neutralwerte fuer ACC Sensor fest einstellen. Startausrichtung ist dann egal ! *****
9
// Laut Datenblatt sind die Werte ueber Zeit und Temperatur sehr stabil. 
10
#define ACC_NEUTRAL_FIXED 1 // wenn eins werden die neutralwerte fuer den ACC Sensor festeingestellt
122 salvo 11
#define ACC_X_NEUTRAL  518    // ADC Wandler Wert in Neutrallage (0g): Vom individuellen Sensor abhaengig
117 salvo 12
#define ACC_Y_NEUTRAL  516    // ADC Wandler wert in Neutrallage (0g)
13
#define ACC_Z_NEUTRAL  745 // ADC Wandler Wert in Neutrallage (1g)
123 salvo 14
 
15
#define ACC_WAAGRECHT_LIMIT 100 // Nick und Roll kleiner als dieser Wert gelten als kriterium fuer waagrechte Lage
16
 
117 salvo 17
// Salvo End
18
 
1 ingob 19
extern volatile unsigned char Timeout;
20
extern unsigned char Sekunde,Minute;
21
extern volatile long IntegralNick,IntegralNick2;
22
extern volatile long IntegralRoll,IntegralRoll2;
23
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
24
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
25
extern volatile long Mess_Integral_Hoch;
26
extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
27
extern volatile int  KompassValue;
28
extern volatile int  KompassStartwert;
29
extern volatile int  KompassRichtung;
30
extern int HoehenWert;
31
extern int SollHoehe;
32
extern volatile int MesswertNick,MesswertRoll,MesswertGier;
33
extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
34
extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
35
extern volatile float NeutralAccZ;
36
 
37
 
38
void MotorRegler(void);
39
void SendMotorData(void);
40
void CalibrierMittelwert(void);
41
void Mittelwert(void);
42
void SetNeutral(void);
43
 
44
unsigned char h,m,s;
45
volatile unsigned char Timeout ;
46
unsigned char CosinusNickWinkel, CosinusRollWinkel;
47
volatile long IntegralNick,IntegralNick2;
48
volatile long IntegralRoll,IntegralRoll2;
49
volatile long Integral_Gier;
50
volatile long Mess_IntegralNick,Mess_IntegralNick2;
51
volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
52
volatile long Mess_Integral_Gier;
53
volatile int  DiffNick,DiffRoll;
54
extern int  Poti1, Poti2, Poti3, Poti4;
55
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
56
unsigned char MotorWert[5];
57
volatile unsigned char SenderOkay;
58
int StickNick,StickRoll,StickGier;
59
char MotorenEin;
60
extern void DefaultKonstanten(void);
61
 
62
#define  STRUCT_PARAM_LAENGE  58
63
struct mk_param_struct
64
 {
65
   unsigned char Kanalbelegung[8];        // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
66
   unsigned char GlobalConfig;            // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
67
   unsigned char Hoehe_MinGas;            // Wert : 0-100
68
   unsigned char Luftdruck_D;             // Wert : 0-250
69
   unsigned char MaxHoehe;                // Wert : 0-32
70
   unsigned char Hoehe_P;                 // Wert : 0-32
71
   unsigned char Hoehe_Verstaerkung;      // Wert : 0-50
72
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
73
   unsigned char Stick_P;                // Wert : 1-6
74
   unsigned char Stick_D;                // Wert : 0-64
75
   unsigned char Gier_P;                 // Wert : 1-20
76
   unsigned char Gas_Min;                // Wert : 0-32
77
   unsigned char Gas_Max;                // Wert : 33-250
78
   unsigned char GyroAccFaktor;          // Wert : 1-64
79
   unsigned char KompassWirkung;         // Wert : 0-32
80
   unsigned char Gyro_P;                 // Wert : 10-250
81
   unsigned char Gyro_I;                 // Wert : 0-250
82
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
83
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
84
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
85
   unsigned char UfoAusrichtung;         // X oder + Formation
86
   unsigned char I_Faktor;               // Wert : 0-250
87
   unsigned char UserParam1;             // Wert : 0-250
88
   unsigned char UserParam2;             // Wert : 0-250
89
   unsigned char UserParam3;             // Wert : 0-250
90
   unsigned char UserParam4;             // Wert : 0-250
91
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
92
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
93
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
94
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
95
   unsigned char ServoNickRefresh;       // Wert : 0-250     // Richtung Einfluss Gyro/Servo
96
   unsigned char ServoNickCompInvert;    // Wert : 0-250     // Richtung Einfluss Gyro/Servo
97
   unsigned char Reserved[7];
98
   char Name[12];
99
 };
100
 
101
 
102
 
103
 
104
extern struct mk_param_struct EE_Parameter;
105
 
106
extern unsigned char Parameter_Luftdruck_D;
107
extern unsigned char Parameter_MaxHoehe;
108
extern unsigned char Parameter_Hoehe_P;
109
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
110
extern unsigned char Parameter_KompassWirkung;
111
extern unsigned char Parameter_Gyro_P;
112
extern unsigned char Parameter_Gyro_I;
113
extern unsigned char Parameter_Gier_P;
114
extern unsigned char Parameter_ServoNickControl;
115
 
116
#endif //_FC_H
117