mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 21:35:44 +03:00
Removed unnecessary acc calculation when no alt hold
This commit is contained in:
parent
4476921cac
commit
cfca75204f
1 changed files with 4 additions and 0 deletions
|
@ -178,6 +178,7 @@ void imuResetAccelerationSum(void)
|
||||||
accTimeSum = 0;
|
accTimeSum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(USE_ALT_HOLD)
|
||||||
static void imuTransformVectorBodyToEarth(t_fp_vector * v)
|
static void imuTransformVectorBodyToEarth(t_fp_vector * v)
|
||||||
{
|
{
|
||||||
/* From body frame to earth frame */
|
/* From body frame to earth frame */
|
||||||
|
@ -227,6 +228,7 @@ static void imuCalculateAcceleration(uint32_t deltaT)
|
||||||
accTimeSum += deltaT;
|
accTimeSum += deltaT;
|
||||||
accSumCount++;
|
accSumCount++;
|
||||||
}
|
}
|
||||||
|
#endif // USE_ALT_HOLD
|
||||||
|
|
||||||
static float invSqrt(float x)
|
static float invSqrt(float x)
|
||||||
{
|
{
|
||||||
|
@ -452,7 +454,9 @@ static void imuCalculateEstimatedAttitude(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
imuUpdateEulerAngles();
|
imuUpdateEulerAngles();
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(USE_ALT_HOLD)
|
||||||
imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
|
imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void imuUpdateAttitude(timeUs_t currentTimeUs)
|
void imuUpdateAttitude(timeUs_t currentTimeUs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue