1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Fix gyro calibration zero offset calculation

It seems like the gyro calibration sample count overflow fix (#5898) caused a downstream problem with the math to calculate the zero offset.  Casting the components of the formula to (float) solves the problem.
This commit is contained in:
Bruce Luckcuck 2018-05-16 13:06:07 -04:00
parent 1c605c3842
commit ce170990a2

View file

@ -933,7 +933,7 @@ STATIC_UNIT_TESTED void performGyroCalibration(gyroSensor_t *gyroSensor, uint8_t
}
// please take care with exotic boardalignment !!
gyroSensor->gyroDev.gyroZero[axis] = gyroSensor->calibration.sum[axis] / gyroCalculateCalibratingCycles();
gyroSensor->gyroDev.gyroZero[axis] = (float)gyroSensor->calibration.sum[axis] / (float)gyroCalculateCalibratingCycles();
if (axis == Z) {
gyroSensor->gyroDev.gyroZero[axis] -= ((float)gyroConfig()->gyro_offset_yaw / 100);
}