From ce170990a214f61fc0294dbac667a39d77d6380d Mon Sep 17 00:00:00 2001 From: Bruce Luckcuck Date: Wed, 16 May 2018 13:06:07 -0400 Subject: [PATCH] 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. --- src/main/sensors/gyro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 84c0ef7959..4b4a987efa 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -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); }