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

Cleanup of acc device drivers extern usage CF PR#2117

This commit is contained in:
Martin Budden 2016-06-16 18:09:05 +01:00
parent 5e84431e7a
commit e9a46c6ebb
21 changed files with 41 additions and 44 deletions

View file

@ -124,7 +124,7 @@ void imuInit(void)
{
smallAngleCosZ = cos_approx(degreesToRadians(imuRuntimeConfig->small_angle));
gyroScale = gyro.scale * (M_PIf / 180.0f); // gyro output scaled to rad per second
accVelScale = 9.80665f / acc_1G / 10000.0f;
accVelScale = 9.80665f / acc.acc_1G / 10000.0f;
imuComputeRotationMatrix();
}
@ -189,7 +189,7 @@ void imuCalculateAcceleration(uint32_t deltaT)
}
accel_ned.V.Z -= accZoffset / 64; // compensate for gravitation on z-axis
} else
accel_ned.V.Z -= acc_1G;
accel_ned.V.Z -= acc.acc_1G;
accz_smooth = accz_smooth + (dT / (fc_acc + dT)) * (accel_ned.V.Z - accz_smooth); // low pass filter
@ -362,7 +362,7 @@ static bool imuIsAccelerometerHealthy(void)
accMagnitude += (int32_t)accSmooth[axis] * accSmooth[axis];
}
accMagnitude = accMagnitude * 100 / (sq((int32_t)acc_1G));
accMagnitude = accMagnitude * 100 / (sq((int32_t)acc.acc_1G));
// Accept accel readings only in range 0.90g - 1.10g
return (81 < accMagnitude) && (accMagnitude < 121);