Subversion Repositories FlightCtrl

Rev

Rev 2102 | Rev 2105 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2102 Rev 2104
Line 24... Line 24...
24
#define FC_ERROR1_MIXER         0x10
24
#define FC_ERROR1_MIXER         0x10
25
#define FC_ERROR1_RES1          0x20
25
#define FC_ERROR1_RES1          0x20
26
#define FC_ERROR1_RES2          0x40
26
#define FC_ERROR1_RES2          0x40
27
#define FC_ERROR1_RES3          0x80
27
#define FC_ERROR1_RES3          0x80
Line -... Line 28...
-
 
28
 
-
 
29
typedef struct {
-
 
30
  uint8_t gyroQuadrant;
-
 
31
  uint8_t accQuadrant;
-
 
32
  uint8_t imuReversedFlags;
-
 
33
 
-
 
34
  uint8_t gyroPIDFilterConstant;
-
 
35
  uint8_t gyroDWindowLength;
-
 
36
  uint8_t gyroDFilterConstant;
-
 
37
  uint8_t accFilterConstant;
-
 
38
 
-
 
39
  uint8_t zerothOrderCorrection;
-
 
40
  uint8_t rateTolerance;
-
 
41
 
-
 
42
  uint8_t gyroActivityDamping;
-
 
43
  uint8_t driftCompDivider; // 1/k  (Koppel_ACC_Wirkung)
-
 
44
  uint8_t driftCompLimit;   // limit for gyrodrift compensation
-
 
45
} IMUConfig_t;
-
 
46
 
-
 
47
extern IMUConfig_t IMUConfig;
-
 
48
 
-
 
49
typedef struct {
-
 
50
        uint8_t P;
-
 
51
        uint8_t I;
-
 
52
        uint8_t D;
-
 
53
} PID_t;
-
 
54
 
-
 
55
typedef struct {
-
 
56
        uint8_t P;
-
 
57
        uint8_t I;
-
 
58
        uint8_t D;
-
 
59
        uint8_t iMax;
-
 
60
} PIDIM_t;
28
 
61
 
29
typedef enum {
62
typedef enum {
30
  FLIGHT_MODE_NONE,
63
  FLIGHT_MODE_NONE,
31
  FLIGHT_MODE_MANUAL,
64
  FLIGHT_MODE_MANUAL,
32
  FLIGHT_MODE_RATE,
65
  FLIGHT_MODE_RATE,
Line 47... Line 80...
47
}__attribute__((packed)) VersionInfo_t;
80
}__attribute__((packed)) VersionInfo_t;
Line 48... Line 81...
48
 
81
 
Line 49... Line 82...
49
extern VersionInfo_t versionInfo;
82
extern VersionInfo_t versionInfo;
50
 
83
 
51
typedef struct {
-
 
52
  /*PMM*/uint8_t gyroPitchD;
84
typedef struct {
Line 53... Line 85...
53
  /* P */uint8_t gyroRollD;\
85
  // IMU stuff:
54
  /* P */uint8_t gyroYawD;
86
  PID_t gyroPID[3];
Line 55... Line 87...
55
 
87
 
Line 106... Line 138...
106
typedef struct {
138
typedef struct {
107
  uint8_t bitmask;
139
  uint8_t bitmask;
108
  uint8_t timing;
140
  uint8_t timing;
109
} output_flash_t;
141
} output_flash_t;
Line 110... Line -...
110
 
-
 
111
typedef struct {
-
 
112
  uint8_t gyroQuadrant;
-
 
113
  uint8_t accQuadrant;
-
 
114
  uint8_t imuReversedFlags;
-
 
115
 
-
 
116
  uint8_t gyroPIDFilterConstant;
-
 
117
  uint8_t gyroDWindowLength;
-
 
118
  uint8_t gyroDFilterConstant;
-
 
119
  uint8_t accFilterConstant;
-
 
120
 
-
 
121
  uint8_t zerothOrderCorrection;
-
 
122
  uint8_t rateTolerance;
-
 
123
 
-
 
124
  uint8_t gyroActivityDamping;
-
 
125
  uint8_t driftCompDivider; // 1/k  (Koppel_ACC_Wirkung)
-
 
126
  uint8_t driftCompLimit;   // limit for gyrodrift compensation
-
 
127
} IMUConfig_t;
-
 
128
 
-
 
129
extern IMUConfig_t IMUConfig;
-
 
130
 
-
 
131
typedef struct {
-
 
132
        uint8_t P;
-
 
133
        uint8_t I;
-
 
134
        uint8_t D;
-
 
135
} PID_t;
-
 
136
 
142
 
137
// values above 250 representing poti1 to poti4
143
// values above 250 representing poti1 to poti4
138
typedef struct {
144
typedef struct {
139
  // Global bitflags
145
  // Global bitflags
Line 140... Line -...
140
  uint8_t bitConfig;  // see upper defines for bitcoding
-
 
141
 
-
 
142
  // uint8_t axisCoupling1; // Value: 0-250  Faktor, mit dem Yaw die Achsen Roll und Nick koppelt (NickRollMitkopplung)
-
 
143
  // uint8_t axisCoupling2; // Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
-
 
144
  // uint8_t axisCouplingYawCorrection;// Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
-
 
145
 
-
 
146
  uint8_t levelCorrection[2];
146
  uint8_t bitConfig;  // see upper defines for bitcoding
147
 
147
 
Line 148... Line 148...
148
  // Control
148
  // Control
149
  PID_t gyroPID[3];
149
  PIDIM_t gyroPID[3];
150
 
150
 
Line 180... Line 180...
180
} ParamSet_t;
180
} ParamSet_t;
Line 181... Line 181...
181
 
181
 
Line 182... Line 182...
182
extern ParamSet_t staticParams;
182
extern ParamSet_t staticParams;
183
 
183
 
184
// bit mask for staticParams.bitConfig
-
 
185
#define CFG_SIMPLE_HEIGHT_CONTROL       (1<<0)
-
 
186
#define CFG_SIMPLE_HC_HOLD_SWITCH       (1<<1)
184
// bit mask for staticParams.bitConfig
187
#define CFG_HEADING_HOLD                (1<<2)
-
 
188
#define CFG_COMPASS_ENABLED             (1<<3)
-
 
189
#define CFG_UNUSED                      (1<<4)
-
 
190
#define CFG_NAVI_ENABLED                (1<<5)
-
 
Line 191... Line 185...
191
#define CFG_AXIS_COUPLING_ENABLED       (1<<6)
185
#define CFG_GYRO_SATURATION_PREVENTION  (1<<0)
192
#define CFG_GYRO_SATURATION_PREVENTION  (1<<7)
186
#define CFG_USE_AIRSPEED_PID            (1<<1)
193
 
187
 
194
#define IMU_REVERSE_GYRO_PR             (1<<0)
188
#define IMU_REVERSE_GYRO_PR             (1<<0)