1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

change divisions by acc_1G to multiply by the reciprocal value

This commit is contained in:
leocb 2018-08-09 14:41:05 -03:00
parent 946cbd257f
commit 34b0707cb6
8 changed files with 13 additions and 11 deletions

View file

@ -171,7 +171,7 @@ void imuConfigure(uint16_t throttle_correction_angle, uint8_t throttle_correctio
void imuInit(void)
{
smallAngleCosZ = cos_approx(degreesToRadians(imuRuntimeConfig.small_angle));
accVelScale = 9.80665f / acc.dev.acc_1G / 10000.0f;
accVelScale = 9.80665f * acc.dev.acc_1G_rec / 10000.0f;
#ifdef USE_GPS
canUseGPSHeading = true;
@ -361,10 +361,10 @@ static bool imuIsAccelerometerHealthy(float *accAverage)
accMagnitude += a * a;
}
accMagnitude = accMagnitude * 100 / (sq((int32_t)acc.dev.acc_1G));
accMagnitude = sqrtf(accMagnitude) * acc.dev.acc_1G_rec;
// Accept accel readings only in range 0.90g - 1.10g
return (81 < accMagnitude) && (accMagnitude < 121);
// Accept accel readings only in range 0.80g - 1.20g
return (0.80f <= accMagnitude) && (accMagnitude <= 1.20f);
}
// Calculate the dcmKpGain to use. When armed, the gain is imuRuntimeConfig.dcm_kp * 1.0 scaling.