Move calibrationCompleted flag to a 4th element in the accZero structure
[betaflight.git] / src / main / sensors / sensors.h
blob531c67c97f5155410910994d01bd6f4e8227631b
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 typedef enum {
24 SENSOR_INDEX_GYRO = 0,
25 SENSOR_INDEX_ACC,
26 SENSOR_INDEX_BARO,
27 SENSOR_INDEX_MAG,
28 SENSOR_INDEX_RANGEFINDER,
29 SENSOR_INDEX_COUNT
30 } sensorIndex_e;
32 extern uint8_t requestedSensors[SENSOR_INDEX_COUNT];
33 extern uint8_t detectedSensors[SENSOR_INDEX_COUNT];
35 typedef struct int16_flightDynamicsTrims_s {
36 int16_t roll;
37 int16_t pitch;
38 int16_t yaw;
39 int16_t calibrationCompleted;
40 } flightDynamicsTrims_def_t;
42 typedef union flightDynamicsTrims_u {
43 int16_t raw[4];
44 flightDynamicsTrims_def_t values;
45 } flightDynamicsTrims_t;
47 #define CALIBRATING_ACC_CYCLES 400
48 #define CALIBRATING_BARO_CYCLES 200 // 10 seconds init_delay + 200 * 25 ms = 15 seconds before ground pressure settles
50 typedef enum {
51 SENSOR_GYRO = 1 << 0, // always present
52 SENSOR_ACC = 1 << 1,
53 SENSOR_BARO = 1 << 2,
54 SENSOR_MAG = 1 << 3,
55 SENSOR_SONAR = 1 << 4,
56 SENSOR_RANGEFINDER = 1 << 4,
57 SENSOR_GPS = 1 << 5,
58 SENSOR_GPSMAG = 1 << 6
59 } sensors_e;