Rev 761 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 761 | Rev 762 | ||
---|---|---|---|
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 | 7 | ||
8 | typedef struct |
8 | typedef struct |
9 | { |
9 | { |
10 | uint8_t Height_D; |
10 | uint8_t Height_D; |
11 | uint8_t MaxHeight; |
11 | uint8_t MaxHeight; |
12 | uint8_t Height_P; |
12 | uint8_t Height_P; |
13 | uint8_t Height_ACC_Effect; |
13 | uint8_t Height_ACC_Effect; |
14 | uint8_t CompassYawEffect; |
14 | uint8_t CompassYawEffect; |
15 | uint8_t Gyro_P; |
15 | uint8_t Gyro_P; |
16 | uint8_t Gyro_I; |
16 | uint8_t Gyro_I; |
17 | uint8_t Gier_P; |
17 | uint8_t Gier_P; |
18 | uint8_t I_Factor; |
18 | uint8_t I_Factor; |
19 | uint8_t UserParam1; |
19 | uint8_t UserParam1; |
20 | uint8_t UserParam2; |
20 | uint8_t UserParam2; |
21 | uint8_t UserParam3; |
21 | uint8_t UserParam3; |
22 | uint8_t UserParam4; |
22 | uint8_t UserParam4; |
23 | uint8_t UserParam5; |
23 | uint8_t UserParam5; |
24 | uint8_t UserParam6; |
24 | uint8_t UserParam6; |
25 | uint8_t UserParam7; |
25 | uint8_t UserParam7; |
26 | uint8_t UserParam8; |
26 | uint8_t UserParam8; |
27 | uint8_t ServoPitchControl; |
27 | uint8_t ServoPitchControl; |
28 | uint8_t LoopThrustLimit; |
28 | uint8_t LoopThrustLimit; |
29 | uint8_t Yaw_PosFeedback; |
29 | uint8_t Yaw_PosFeedback; |
30 | uint8_t Yaw_NegFeedback; |
30 | uint8_t Yaw_NegFeedback; |
31 | uint8_t DynamicStability; |
31 | uint8_t DynamicStability; |
32 | } fc_param_t; |
32 | } fc_param_t; |
33 | 33 | ||
34 | extern fc_param_t FCParam; |
34 | extern fc_param_t FCParam; |
35 | 35 | ||
36 | extern volatile uint16_t I2CTimeout; |
36 | extern volatile uint16_t I2CTimeout; |
37 | 37 | ||
38 | // attitude |
38 | // attitude |
39 | extern volatile int32_t IntegralPitch, IntegralRoll, IntegralYaw; |
39 | extern volatile int32_t IntegralPitch, IntegralRoll, IntegralYaw; |
40 | extern volatile int16_t Reading_GyroPitch, Reading_GyroRoll, Reading_GyroYaw; |
40 | extern volatile int16_t Reading_GyroPitch, Reading_GyroRoll, Reading_GyroYaw; |
41 | 41 | ||
42 | // offsets |
42 | // offsets |
43 | extern volatile int16_t AdNeutralPitch, AdNeutralRoll, AdNeutralYaw; |
43 | extern volatile int16_t AdNeutralPitch, AdNeutralRoll, AdNeutralYaw; |
44 | extern volatile int16_t NeutralAccX, NeutralAccY; |
44 | extern volatile int16_t NeutralAccX, NeutralAccY; |
45 | extern volatile float NeutralAccZ; |
45 | extern volatile float NeutralAccZ; |
46 | 46 | ||
47 | 47 | ||
48 | extern volatile int32_t Reading_Integral_Top; // calculated in analog.c |
48 | extern volatile int32_t Reading_Integral_Top; // calculated in analog.c |
49 | 49 | ||
50 | // compass navigation |
50 | // compass navigation |
51 | extern volatile int16_t CompassHeading; |
51 | extern volatile int16_t CompassHeading; |
52 | extern volatile int16_t CompassCourse; |
52 | extern volatile int16_t CompassCourse; |
53 | extern volatile int16_t CompassOffCourse; |
53 | extern volatile int16_t CompassOffCourse; |
54 | 54 | ||
55 | // hight control |
55 | // hight control |
56 | extern int ReadingHeight; |
56 | extern int ReadingHeight; |
57 | extern int SetPointHeight; |
57 | extern int SetPointHeight; |
58 | 58 | ||
59 | // mean accelarations |
59 | // mean accelarations |
60 | extern volatile int16_t Mean_AccPitch, Mean_AccRoll, Mean_AccTop; |
60 | extern volatile int16_t Mean_AccPitch, Mean_AccRoll, Mean_AccTop; |
61 | 61 | ||
62 | // looping params |
62 | // looping params |
63 | extern long TurnOver180Pitch, TurnOver180Roll; |
63 | extern long TurnOver180Pitch, TurnOver180Roll; |
64 | 64 | ||
65 | // external control |
65 | // external control |
66 | extern int16_t ExternStickPitch, ExternStickRoll, ExternStickYaw; |
66 | extern int16_t ExternStickPitch, ExternStickRoll, ExternStickYaw; |
67 | 67 | ||
68 | 68 | ||
69 | void MotorControl(void); |
69 | void MotorControl(void); |
70 | void SendMotorData(void); |
70 | void SendMotorData(void); |
71 | void CalibMean(void); |
71 | void CalibMean(void); |
72 | void Mean(void); |
72 | void Mean(void); |
73 | void SetNeutral(void); |
73 | void SetNeutral(void); |
74 | void Beep(uint8_t numbeeps); |
74 | void Beep(uint8_t numbeeps); |
75 | 75 | ||
76 | 76 | ||
77 | extern int16_t Poti1, Poti2, Poti3, Poti4; |
77 | extern int16_t Poti1, Poti2, Poti3, Poti4, Poti5, Poti6, Poti7, Poti8; |
78 | 78 | ||
79 | // setpoints for motors |
79 | // setpoints for motors |
80 | extern volatile uint8_t Motor_Front, Motor_Rear, Motor_Right, Motor_Left; //used by twimaster isr |
80 | extern volatile uint8_t Motor_Front, Motor_Rear, Motor_Right, Motor_Left; //used by twimaster isr |
81 | 81 | ||
82 | // current stick values |
82 | // current stick values |
83 | extern int16_t StickPitch, StickRoll, StickYaw; |
83 | extern int16_t StickPitch, StickRoll, StickYaw; |
84 | // current stick elongations |
84 | // current stick elongations |
85 | extern int16_t MaxStickPitch, MaxStickRoll, MaxStickYaw; |
85 | extern int16_t MaxStickPitch, MaxStickRoll, MaxStickYaw; |
86 | extern uint8_t MotorsOn; |
86 | extern uint8_t MotorsOn; |
87 | extern uint8_t EmergencyLanding; |
87 | extern uint8_t EmergencyLanding; |
88 | 88 | ||
89 | 89 | ||
90 | #endif //_FC_H |
90 | #endif //_FC_H |
91 | 91 | ||
92 | 92 |