mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Use float for imuIsAccelerometerHealthy calculation
This commit is contained in:
parent
4476921cac
commit
b6c3a9f19a
1 changed files with 3 additions and 2 deletions
|
@ -389,9 +389,10 @@ STATIC_UNIT_TESTED void imuUpdateEulerAngles(void){
|
|||
|
||||
static bool imuIsAccelerometerHealthy(void)
|
||||
{
|
||||
int32_t accMagnitude = 0;
|
||||
float accMagnitude = 0;
|
||||
for (int axis = 0; axis < 3; axis++) {
|
||||
accMagnitude += (int32_t)acc.accSmooth[axis] * acc.accSmooth[axis];
|
||||
const float a = acc.accSmooth[axis];
|
||||
accMagnitude += a * a;
|
||||
}
|
||||
|
||||
accMagnitude = accMagnitude * 100 / (sq((int32_t)acc.dev.acc_1G));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue