More relocation of variables.
[betaflight.git] / src / main / flight / flight.h
blobb702734169d12fe96d60d1dfab47839ff6cf5697
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
21 typedef enum {
22 PIDROLL,
23 PIDPITCH,
24 PIDYAW,
25 PIDALT,
26 PIDPOS,
27 PIDPOSR,
28 PIDNAVR,
29 PIDLEVEL,
30 PIDMAG,
31 PIDVEL,
32 PID_ITEM_COUNT
33 } pidIndex_e;
35 #define IS_PID_CONTROLLER_FP_BASED(pidController) (pidController == 2)
37 typedef struct pidProfile_s {
38 uint8_t pidController; // 0 = multiwii original, 1 = rewrite from http://www.multiwii.com/forum/viewtopic.php?f=8&t=3671, 1, 2 = Luggi09s new baseflight pid
40 uint8_t P8[PID_ITEM_COUNT];
41 uint8_t I8[PID_ITEM_COUNT];
42 uint8_t D8[PID_ITEM_COUNT];
44 float P_f[3]; // float p i and d factors for lux float pid controller
45 float I_f[3];
46 float D_f[3];
47 float A_level;
48 float H_level;
49 uint8_t H_sensitivity;
50 } pidProfile_t;
52 #define DEGREES_TO_DECIDEGREES(angle) (angle * 10)
53 #define DECIDEGREES_TO_DEGREES(angle) (angle / 10.0f)
55 extern int16_t axisPID[XYZ_AXIS_COUNT];
56 extern int32_t axisPID_P[3], axisPID_I[3], axisPID_D[3];
58 void setPIDController(int type);
59 void resetErrorAngle(void);
60 void resetErrorGyro(void);