1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP-1317 changed int into int32_t in function Quaternion2PY()

This commit is contained in:
Andres 2014-07-20 15:26:05 +02:00
parent 642f740be3
commit ddde6d1f5e

View File

@ -97,10 +97,10 @@ static void Quaternion2PY(const float q0, const float q1, const float q2, const
} else {
// calculate needed mutliples of 2pi to avoid jumps
// number of cycles accumulated in old yaw
const int cycles = (int)(*yPtr / TWO_PI);
const int32_t cycles = (int32_t)(*yPtr / TWO_PI);
// look for a jump by substracting the modulus, i.e. there is maximally one jump.
// take slightly less than 2pi, because the jump will always be lower than 2pi
const int mod = (int)((y_ - (*yPtr - cycles * TWO_PI)) / (TWO_PI * 0.9f));
const int32_t mod = (int32_t)((y_ - (*yPtr - cycles * TWO_PI)) / (TWO_PI * 0.8f));
*yPtr = y_ + TWO_PI * (cycles - mod);
}
}