Subversion Repositories FlightCtrl

Rev

Rev 2 | 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
 
29 4ndreas 8
 
9
//#define My stuff
10
 
11
#define MS_SCHALTERWERT1        20
12
#define MS_SCHALTERWERT2        100
13
#define MS_SCHALTERWERT3        200
14
#define MS_SERVO_AN                     100
15
 
16
#define T1_ON PORTC |= 0x04
17
#define T1_OFF PORTC &=~0x04
18
#define T1_Switch PORTC ^= (1<<PIN2)
19
#define T2_ON PORTC |= 0x08
20
#define T2_OFF PORTC &=~0x08
21
#define T2_Switch PORTC ^= (1<<PIN3)
22
 
23
extern unsigned int Blinki;
24
unsigned char Blinkzeit;
25
//end My stuff 
26
 
27
 
1 ingob 28
extern volatile unsigned char Timeout;
29
extern unsigned char Sekunde,Minute;
30
extern volatile long IntegralNick,IntegralNick2;
31
extern volatile long IntegralRoll,IntegralRoll2;
32
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
33
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
34
extern volatile long Mess_Integral_Hoch;
35
extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
36
extern volatile int  KompassValue;
37
extern volatile int  KompassStartwert;
38
extern volatile int  KompassRichtung;
39
extern int HoehenWert;
40
extern int SollHoehe;
41
extern volatile int MesswertNick,MesswertRoll,MesswertGier;
42
extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
43
extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
44
extern volatile float NeutralAccZ;
45
 
46
 
47
void MotorRegler(void);
48
void SendMotorData(void);
49
void CalibrierMittelwert(void);
50
void Mittelwert(void);
51
void SetNeutral(void);
52
 
53
unsigned char h,m,s;
54
volatile unsigned char Timeout ;
55
unsigned char CosinusNickWinkel, CosinusRollWinkel;
56
volatile long IntegralNick,IntegralNick2;
57
volatile long IntegralRoll,IntegralRoll2;
58
volatile long Integral_Gier;
59
volatile long Mess_IntegralNick,Mess_IntegralNick2;
60
volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
61
volatile long Mess_Integral_Gier;
62
volatile int  DiffNick,DiffRoll;
63
extern int  Poti1, Poti2, Poti3, Poti4;
64
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
65
unsigned char MotorWert[5];
66
volatile unsigned char SenderOkay;
67
int StickNick,StickRoll,StickGier;
68
char MotorenEin;
69
extern void DefaultKonstanten(void);
70
 
71
#define  STRUCT_PARAM_LAENGE  58
72
struct mk_param_struct
73
 {
74
   unsigned char Kanalbelegung[8];        // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
75
   unsigned char GlobalConfig;            // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
76
   unsigned char Hoehe_MinGas;            // Wert : 0-100
77
   unsigned char Luftdruck_D;             // Wert : 0-250
78
   unsigned char MaxHoehe;                // Wert : 0-32
79
   unsigned char Hoehe_P;                 // Wert : 0-32
80
   unsigned char Hoehe_Verstaerkung;      // Wert : 0-50
81
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
82
   unsigned char Stick_P;                // Wert : 1-6
83
   unsigned char Stick_D;                // Wert : 0-64
84
   unsigned char Gier_P;                 // Wert : 1-20
85
   unsigned char Gas_Min;                // Wert : 0-32
86
   unsigned char Gas_Max;                // Wert : 33-250
87
   unsigned char GyroAccFaktor;          // Wert : 1-64
88
   unsigned char KompassWirkung;         // Wert : 0-32
89
   unsigned char Gyro_P;                 // Wert : 10-250
90
   unsigned char Gyro_I;                 // Wert : 0-250
91
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
92
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
93
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
94
   unsigned char UfoAusrichtung;         // X oder + Formation
95
   unsigned char I_Faktor;               // Wert : 0-250
96
   unsigned char UserParam1;             // Wert : 0-250
97
   unsigned char UserParam2;             // Wert : 0-250
98
   unsigned char UserParam3;             // Wert : 0-250
99
   unsigned char UserParam4;             // Wert : 0-250
100
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
101
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
102
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
103
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
104
   unsigned char ServoNickRefresh;       // Wert : 0-250     // Richtung Einfluss Gyro/Servo
105
   unsigned char ServoNickCompInvert;    // Wert : 0-250     // Richtung Einfluss Gyro/Servo
106
   unsigned char Reserved[7];
107
   char Name[12];
108
 };
109
 
110
 
111
 
112
 
113
extern struct mk_param_struct EE_Parameter;
114
 
115
extern unsigned char Parameter_Luftdruck_D;
116
extern unsigned char Parameter_MaxHoehe;
117
extern unsigned char Parameter_Hoehe_P;
118
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
119
extern unsigned char Parameter_KompassWirkung;
120
extern unsigned char Parameter_Gyro_P;
121
extern unsigned char Parameter_Gyro_I;
122
extern unsigned char Parameter_Gier_P;
123
extern unsigned char Parameter_ServoNickControl;
124
 
125
#endif //_FC_H
126