Subversion Repositories FlightCtrl

Rev

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

Rev 2017 Rev 2018
Line 5... Line 5...
5
#include <avr/io.h>
5
#include <avr/io.h>
Line 6... Line 6...
6
 
6
 
7
#define MAX_CHANNELS 10
7
#define MAX_CHANNELS 10
Line -... Line 8...
-
 
8
#define MAX_MOTORS 12
-
 
9
 
-
 
10
// bitmask for VersionInfo_t.HardwareError[0]
-
 
11
#define FC_ERROR0_GYRO_PITCH    0x01
-
 
12
#define FC_ERROR0_GYRO_ROLL     0x02
-
 
13
#define FC_ERROR0_GYRO_YAW              0x04
-
 
14
#define FC_ERROR0_ACC_X                 0x08
-
 
15
#define FC_ERROR0_ACC_Y                 0x10
-
 
16
#define FC_ERROR0_ACC_Z                 0x20
-
 
17
#define FC_ERROR0_PRESSURE              0x40
-
 
18
#define FC_ERROR1_RES0                  0x80
-
 
19
// bitmask for VersionInfo_t.HardwareError[1]
-
 
20
#define FC_ERROR1_I2C                   0x01
-
 
21
#define FC_ERROR1_BL_MISSING    0x02
-
 
22
#define FC_ERROR1_SPI_RX                0x04
-
 
23
#define FC_ERROR1_PPM                   0x08
-
 
24
#define FC_ERROR1_MIXER                 0x10
-
 
25
#define FC_ERROR1_RES1                  0x20
-
 
26
#define FC_ERROR1_RES2                  0x40
-
 
27
#define FC_ERROR1_RES3                  0x80
-
 
28
 
-
 
29
typedef struct {
-
 
30
        uint8_t SWMajor;
-
 
31
        uint8_t SWMinor;
-
 
32
        uint8_t protoMajor;
-
 
33
        uint8_t protoMinor;
-
 
34
        uint8_t SWPatch;
-
 
35
        uint8_t hardwareErrors[5];
-
 
36
}__attribute__((packed)) VersionInfo_t;
-
 
37
 
8
#define MAX_MOTORS 12
38
extern VersionInfo_t versionInfo;
9
 
39
 
10
typedef struct {
40
typedef struct {
11
  // IMU
41
  // IMU
12
  /*PMM*/uint8_t gyroP;
42
  /*PMM*/uint8_t gyroP;
Line 89... Line 119...
89
typedef struct {
119
typedef struct {
90
  // Global bitflags
120
  // Global bitflags
91
  uint8_t bitConfig;  // see upper defines for bitcoding
121
  uint8_t bitConfig;  // see upper defines for bitcoding
Line 92... Line 122...
92
 
122
 
-
 
123
  // Height Control
93
  // Height Control
124
  uint8_t airpressureFilter;
94
  uint8_t heightP; // Value : 0-32
125
  uint8_t heightP;
95
  uint8_t heightD; // Value : 0-250
126
  uint8_t heightD;
96
  uint8_t heightSetting; // Value : 0-32
127
  uint8_t heightSetting;
97
  uint8_t heightControlMaxThrottleChange; // Value : 0-100
128
  uint8_t heightControlMaxThrottleChange;
Line 98... Line 129...
98
  uint8_t heightSlewRate; // Value : 0-50
129
  uint8_t heightSlewRate;
99
 
130
 
Line 100... Line 131...
100
  // Attitude Control
131
  // Attitude Control
101
  uint8_t attitudeControl;
132
  uint8_t attitudeControl;
102
 
133
 
103
  // Control
134
  // Control
104
  uint8_t stickP; // Value : 1-6
135
  uint8_t stickP;
105
  uint8_t stickD; // Value : 0-64
136
  uint8_t stickD;
106
  uint8_t stickYawP; // Value : 1-20
137
  uint8_t stickYawP;
107
  uint8_t stickThrottleD;
138
  uint8_t stickThrottleD;
108
  uint8_t minThrottle; // Value : 0-32
139
  uint8_t minThrottle;
109
  uint8_t maxThrottle; // Value : 33-250
140
  uint8_t maxThrottle;
110
  uint8_t externalControl; // for serial Control
141
  uint8_t externalControl; // for serial Control
Line 120... Line 151...
120
  uint8_t gyroPIDFilterConstant;
151
  uint8_t gyroPIDFilterConstant;
121
  uint8_t gyroATTFilterConstant;
152
  uint8_t gyroATTFilterConstant;
122
  uint8_t gyroDFilterConstant;
153
  uint8_t gyroDFilterConstant;
123
  uint8_t accFilterConstant;
154
  uint8_t accFilterConstant;
Line 124... Line 155...
124
 
155
 
125
  uint8_t gyroP; // Value : 10-250
156
  uint8_t gyroP;
126
  uint8_t gyroI; // Value : 0-250
157
  uint8_t gyroI;
Line 127... Line 158...
127
  uint8_t gyroD; // Value : 0-250
158
  uint8_t gyroD;
128
 
159
 
129
  uint8_t zerothOrderCorrection; // Value : 1-64
160
  uint8_t zerothOrderCorrection;
Line 130... Line 161...
130
  uint8_t driftCompDivider; // 1/k  (Koppel_ACC_Wirkung)
161
  uint8_t driftCompDivider; // 1/k  (Koppel_ACC_Wirkung)
131
  uint8_t driftCompLimit;   // limit for gyrodrift compensation
162
  uint8_t driftCompLimit;   // limit for gyrodrift compensation
132
 
163
 
Line 133... Line 164...
133
  uint8_t axisCoupling1; // Value: 0-250  Faktor, mit dem Yaw die Achsen Roll und Nick koppelt (NickRollMitkopplung)
164
  uint8_t axisCoupling1; // Value: 0-250  Faktor, mit dem Yaw die Achsen Roll und Nick koppelt (NickRollMitkopplung)
134
  uint8_t axisCoupling2; // Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
165
  uint8_t axisCoupling2; // Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
135
  uint8_t axisCouplingYawCorrection;// Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
166
  uint8_t axisCouplingYawCorrection;// Value: 0-250  Faktor, mit dem Nick und Roll verkoppelt werden
136
 
167
 
137
  uint8_t dynamicStability; // PID limit for Attitude controller
168
  uint8_t dynamicStability; // PID limit for Attitude controller
Line 138... Line 169...
138
  uint8_t IFactor; // Value : 0-250
169
  uint8_t IFactor;
139
  uint8_t yawIFactor;
170
  uint8_t yawIFactor;
140
  uint8_t compassYawEffect; // Value : 0-32
171
  uint8_t compassYawEffect;
141
  uint8_t levelCorrection[2];
172
  uint8_t levelCorrection[2];
Line 142... Line 173...
142
 
173
 
143
  // Servos
174
  // Servos
144
  uint8_t servoCount;
175
  uint8_t servoCount;
145
  uint8_t servoManualMaxSpeed;
176
  uint8_t servoManualMaxSpeed;
Line 146... Line 177...
146
  servo_t servoConfigurations[2]; // [PITCH, ROLL]
177
  servo_t servoConfigurations[2]; // [PITCH, ROLL]
147
 
178
 
148
  // Battery warning and emergency flight
179
  // Battery warning and emergency flight
149
  uint8_t batteryVoltageWarning; // Value : 0-250
180
  uint8_t batteryVoltageWarning;
Line 150... Line 181...
150
  uint8_t emergencyThrottle; // Value : 0-250
181
  uint8_t emergencyThrottle;
151
  uint8_t emergencyFlightDuration; // Value : 0-250 
182
  uint8_t emergencyFlightDuration;
Line 152... Line 183...
152
 
183
 
153
  // Outputs
184
  // Outputs
154
  output_flash_t outputFlash[2];
185
  output_flash_t outputFlash[2];
155
  uint8_t outputDebugMask;
186
  uint8_t outputDebugMask;