Closed se5a closed 12 years ago
code compiles fine, but due to right shift operator gives wrong output. on a 32bit arm platform.
Requires type cast, so the desired 16 bit signed integer is always used: about line 200 in LSM303.cpp in function void LSM303::readAcc(void)
change: a.x = (xha << 8 | xla) >> 4; a.y = (yha << 8 | yla) >> 4; a.z = (zha << 8 | zla) >> 4; to: a.x = (int16_t)(xha << 8 | xla) >> 4; a.y = (int16_t)(yha << 8 | yla) >> 4; a.z = (int16_t)(zha << 8 | zla) >> 4;
Thanks, this should be fixed as of the latest version.
code compiles fine, but due to right shift operator gives wrong output. on a 32bit arm platform.
Requires type cast, so the desired 16 bit signed integer is always used: about line 200 in LSM303.cpp in function void LSM303::readAcc(void)
change: a.x = (xha << 8 | xla) >> 4; a.y = (yha << 8 | yla) >> 4; a.z = (zha << 8 | zla) >> 4; to: a.x = (int16_t)(xha << 8 | xla) >> 4; a.y = (int16_t)(yha << 8 | yla) >> 4; a.z = (int16_t)(zha << 8 | zla) >> 4;