From b32cc09e12945aab4da7f5ec990b3455a8e9a47b Mon Sep 17 00:00:00 2001 From: dongie Date: Wed, 21 May 2014 09:04:07 +0900 Subject: [PATCH] move code around to fix some gcc error that doesn't occur with real compilers --- src/mw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mw.c b/src/mw.c index 66d366768f..58cc7daff1 100755 --- a/src/mw.c +++ b/src/mw.c @@ -362,13 +362,11 @@ static void pidRewrite(void) // ----------PID controller---------- for (axis = 0; axis < 3; axis++) { // -----Get the desired angle rate depending on flight mode - if ((f.ANGLE_MODE || f.HORIZON_MODE) && axis < 2) { // MODE relying on ACC - // calculate error and limit the angle to max configured inclination - errorAngle = constrain((rcCommand[axis] << 1) + GPS_angle[axis], -((int)mcfg.max_angle_inclination), +mcfg.max_angle_inclination) - angle[axis] + cfg.angleTrim[axis]; // 16 bits is ok here - } if (axis == 2) { // YAW is always gyro-controlled (MAG correction is applied to rcCommand) AngleRateTmp = (((int32_t)(cfg.yawRate + 27) * rcCommand[2]) >> 5); } else { + // calculate error and limit the angle to 50 degrees max inclination + errorAngle = (constrain(rcCommand[axis] + GPS_angle[axis], -500, +500) - angle[axis] + cfg.angleTrim[axis]) / 10.0f; // 16 bits is ok here if (!f.ANGLE_MODE) { //control is GYRO based (ACRO and HORIZON - direct sticks control is applied to rate PID AngleRateTmp = ((int32_t)(cfg.rollPitchRate + 27) * rcCommand[axis]) >> 4; if (f.HORIZON_MODE) {