Merge pull request #3679 from jflyper/bfdev-16G-fullscale-for-spi-mpu6000-and-mpu9250

Fighting against gravity: Configurator shows twice the gravity for MPU6000 and MPU9250
This commit is contained in:
Martin Budden 2017-08-01 07:19:46 +01:00 committed by GitHub
commit 869dd1f00e
1 changed files with 11 additions and 1 deletions

View File

@ -738,7 +738,17 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst)
case MSP_RAW_IMU:
{
// Hack scale due to choice of units for sensor data in multiwii
const uint8_t scale = (acc.dev.acc_1G > 512) ? 4 : 1;
uint8_t scale;
if (acc.dev.acc_1G > 512*4) {
scale = 8;
} else if (acc.dev.acc_1G >= 512) {
scale = 4;
} else {
scale = 1;
}
for (int i = 0; i < 3; i++) {
sbufWriteU16(dst, acc.accSmooth[i] / scale);
}