1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Merge pull request #4656 from martinbudden/bfa_imu_acc_alt_hold

Removed unnecessary acc calculation when no alt hold
This commit is contained in:
Martin Budden 2017-11-28 00:51:28 +00:00 committed by GitHub
commit d3d5b107cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,6 +178,7 @@ void imuResetAccelerationSum(void)
accTimeSum = 0;
}
#if defined(USE_ALT_HOLD)
static void imuTransformVectorBodyToEarth(t_fp_vector * v)
{
/* From body frame to earth frame */
@ -227,6 +228,7 @@ static void imuCalculateAcceleration(uint32_t deltaT)
accTimeSum += deltaT;
accSumCount++;
}
#endif // USE_ALT_HOLD
static float invSqrt(float x)
{
@ -453,7 +455,9 @@ static void imuCalculateEstimatedAttitude(timeUs_t currentTimeUs)
imuUpdateEulerAngles();
#endif
#if defined(USE_ALT_HOLD)
imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
#endif
}
void imuUpdateAttitude(timeUs_t currentTimeUs)