forked from multiwii/multiwii-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.h
214 lines (200 loc) · 4.81 KB
/
types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#ifndef TYPES_H_
#define TYPES_H_
enum rc {
ROLL,
PITCH,
YAW,
THROTTLE,
AUX1,
AUX2,
AUX3,
AUX4,
AUX5,
AUX6,
AUX7,
AUX8
};
enum pid {
PIDROLL,
PIDPITCH,
PIDYAW,
PIDALT,
PIDPOS,
PIDPOSR,
PIDNAVR,
PIDLEVEL,
PIDMAG,
PIDVEL, // not used currently
PIDITEMS
};
enum box {
BOXARM,
#if ACC
BOXANGLE,
BOXHORIZON,
#endif
#if BARO && (!defined(SUPPRESS_BARO_ALTHOLD))
BOXBARO,
#endif
#ifdef VARIOMETER
BOXVARIO,
#endif
#if MAG
BOXMAG,
BOXHEADFREE,
BOXHEADADJ, // acquire heading for HEADFREE mode
#endif
#if defined(SERVO_TILT) || defined(GIMBAL) || defined(SERVO_MIX_TILT)
BOXCAMSTAB,
#endif
#if defined(CAMTRIG)
BOXCAMTRIG,
#endif
#if GPS
BOXGPSHOME,
BOXGPSHOLD,
#endif
#if defined(FIXEDWING) || defined(HELICOPTER)
BOXPASSTHRU,
#endif
#if defined(BUZZER)
BOXBEEPERON,
#endif
#if defined(LED_FLASHER)
BOXLEDMAX, // we want maximum illumination
BOXLEDLOW, // low/no lights
#endif
#if defined(LANDING_LIGHTS_DDR)
BOXLLIGHTS, // enable landing lights at any altitude
#endif
#ifdef INFLIGHT_ACC_CALIBRATION
BOXCALIB,
#endif
#ifdef GOVERNOR_P
BOXGOV,
#endif
#ifdef OSD_SWITCH
BOXOSD,
#endif
CHECKBOXITEMS
};
typedef struct {
int16_t accSmooth[3];
int16_t gyroData[3];
int16_t magADC[3];
int16_t gyroADC[3];
int16_t accADC[3];
} imu_t;
typedef struct {
uint8_t vbat; // battery voltage in 0.1V steps
uint16_t intPowerMeterSum;
uint16_t rssi; // range: [0;1023]
uint16_t amperage;
} analog_t;
typedef struct {
int32_t EstAlt; // in cm
int16_t vario; // variometer in cm/s
} alt_t;
typedef struct {
int16_t angle[2]; // absolute angle inclination in multiple of 0.1 degree 180 deg = 1800
int16_t heading; // variometer in cm/s
} att_t;
typedef struct {
uint8_t OK_TO_ARM :1 ;
uint8_t ARMED :1 ;
uint8_t I2C_INIT_DONE :1 ; // For i2c gps we have to now when i2c init is done, so we can update parameters to the i2cgps from eeprom (at startup it is done in setup())
uint8_t ACC_CALIBRATED :1 ;
uint8_t NUNCHUKDATA :1 ;
uint8_t ANGLE_MODE :1 ;
uint8_t HORIZON_MODE :1 ;
uint8_t MAG_MODE :1 ;
uint8_t BARO_MODE :1 ;
uint8_t GPS_HOME_MODE :1 ;
uint8_t GPS_HOLD_MODE :1 ;
uint8_t HEADFREE_MODE :1 ;
uint8_t PASSTHRU_MODE :1 ;
uint8_t GPS_FIX :1 ;
uint8_t GPS_FIX_HOME :1 ;
uint8_t SMALL_ANGLES_25 :1 ;
uint8_t CALIBRATE_MAG :1 ;
uint8_t VARIO_MODE :1;
} flags_struct_t;
typedef struct {
uint8_t currentSet;
int16_t accZero[3];
int16_t magZero[3];
uint16_t flashsum;
uint8_t checksum; // MUST BE ON LAST POSITION OF STRUCTURE !
} global_conf_t;
struct pid_ {
uint8_t P8;
uint8_t I8;
uint8_t D8;
};
struct servo_conf_ { // this is a generic way to configure a servo, every multi type with a servo should use it
int16_t min; // minimum value, must be more than 1020 with the current implementation
int16_t max; // maximum value, must be less than 2000 with the current implementation
int16_t middle; // default should be 1500
int8_t rate; // range [-100;+100] ; can be used to ajust a rate 0-100% and a direction
};
typedef struct {
pid_ pid[PIDITEMS];
uint8_t rcRate8;
uint8_t rcExpo8;
uint8_t rollPitchRate;
uint8_t yawRate;
uint8_t dynThrPID;
uint8_t thrMid8;
uint8_t thrExpo8;
int16_t angleTrim[2];
uint16_t activate[CHECKBOXITEMS];
uint8_t powerTrigger1;
#if MAG
int16_t mag_declination;
#endif
servo_conf_ servoConf[8];
#if defined(GYRO_SMOOTHING)
uint8_t Smoothing[3];
#endif
#if defined (FAILSAFE)
int16_t failsafe_throttle;
#endif
#ifdef VBAT
uint8_t vbatscale;
uint8_t vbatlevel_warn1;
uint8_t vbatlevel_warn2;
uint8_t vbatlevel_crit;
#endif
#ifdef POWERMETER
uint8_t pint2ma;
#endif
#ifdef POWERMETER_HARD
uint16_t psensornull;
#endif
#ifdef MMGYRO
uint8_t mmgyro;
#endif
#ifdef ARMEDTIMEWARNING
uint16_t armedtimewarning;
#endif
int16_t minthrottle;
#ifdef GOVERNOR_P
int16_t governorP;
int16_t governorD;
#endif
uint8_t checksum; // MUST BE ON LAST POSITION OF CONF STRUCTURE !
} conf_t;
#ifdef LOG_PERMANENT
typedef struct {
uint16_t arm; // #arm events
uint16_t disarm; // #disarm events
uint16_t start; // #powercycle/reset/initialize events
uint32_t armed_time ; // copy of armedTime @ disarm
uint32_t lifetime; // sum (armed) lifetime in seconds
uint16_t failsafe; // #failsafe state @ disarm
uint16_t i2c; // #i2c errs state @ disarm
uint8_t running; // toggle on arm & disarm to monitor for clean shutdown vs. powercut
uint8_t checksum; // MUST BE ON LAST POSITION OF CONF STRUCTURE !
} plog_t;
#endif
#endif /* TYPES_H_ */