From b2e7c8d8fcef3aa9c57331b17dacdb4720500df0 Mon Sep 17 00:00:00 2001 From: treymarc Date: Sat, 4 Jan 2014 22:19:51 +0100 Subject: [PATCH] THROTTLE ANGLE CORRECTION , "*" "/" operator priority bug http://www.multiwii.com/forum/viewtopic.php?f=8&t=4433 --- src/imu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imu.c b/src/imu.c index e14fb3280..deddd360a 100755 --- a/src/imu.c +++ b/src/imu.c @@ -315,7 +315,7 @@ static void getEstimatedAttitude(void) acc_calc(deltaT); // rotate acc vector into earth frame if (cfg.throttle_angle_correction) { - int cosZ = EstG.V.Z / (acc_1G * 100.0f); + int cosZ = ((int32_t)(EstG.V.Z * 100.0f)) / acc_1G; throttleAngleCorrection = cfg.throttle_angle_correction * constrain(100 - cosZ, 0, 100) / 8; } }