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/>.
20 extern int16_t throttleAngleCorrection
;
21 extern uint32_t accTimeSum
;
22 extern int accSumCount
;
23 extern float accVelScale
;
25 typedef struct rollAndPitchInclination_s
{
26 // absolute angle inclination in multiple of 0.1 degree 180 deg = 1800
27 int16_t rollDeciDegrees
;
28 int16_t pitchDeciDegrees
;
29 } rollAndPitchInclination_t_def
;
32 int16_t raw
[ANGLE_INDEX_COUNT
];
33 rollAndPitchInclination_t_def values
;
34 } rollAndPitchInclination_t
;
36 extern rollAndPitchInclination_t inclination
;
38 typedef struct accDeadband_s
{
39 uint8_t xy
; // set the acc deadband for xy-Axis
40 uint8_t z
; // set the acc deadband for z-Axis, this ignores small accelerations
43 typedef struct imuRuntimeConfig_s
{
44 uint8_t acc_lpf_factor
;
45 uint8_t acc_unarmedcal
;
46 float gyro_cmpf_factor
;
47 float gyro_cmpfm_factor
;
52 imuRuntimeConfig_t
*initialImuRuntimeConfig
,
53 pidProfile_t
*initialPidProfile
,
54 accDeadband_t
*initialAccDeadband
,
55 float accz_lpf_cutoff
,
56 uint16_t throttle_correction_angle
59 void calculateEstimatedAltitude(uint32_t currentTime
);
60 void imuUpdate(rollAndPitchTrims_t
*accelerometerTrims
, uint8_t mixerMode
);
61 float calculateThrottleAngleScale(uint16_t throttle_correction_angle
);
62 int16_t calculateThrottleAngleCorrection(uint8_t throttle_correction_value
);
63 float calculateAccZLowPassFilterRCTimeConstant(float accz_lpf_cutoff
);
65 int16_t imuCalculateHeading(t_fp_vector
*vec
);
67 void imuResetAccelerationSum(void);