1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

Fixed incorrect accelerometer scaling in MSP (#13026)

This commit is contained in:
Flavio Pinzarrone 2023-12-04 16:50:08 +01:00 committed by GitHub
parent 13d1dc81ce
commit 4c86e31d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1132,24 +1132,10 @@ static bool mspProcessOutCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, sbuf_t
case MSP_RAW_IMU:
{
#if defined(USE_ACC)
// Hack scale due to choice of units for sensor data in multiwii
uint8_t scale;
if (acc.dev.acc_1G > 512 * 4) {
scale = 8;
} else if (acc.dev.acc_1G > 512 * 2) {
scale = 4;
} else if (acc.dev.acc_1G >= 512) {
scale = 2;
} else {
scale = 1;
}
#endif
for (int i = 0; i < 3; i++) {
#if defined(USE_ACC)
sbufWriteU16(dst, lrintf(acc.accADC[i] / scale));
sbufWriteU16(dst, lrintf(acc.accADC[i]));
#else
sbufWriteU16(dst, 0);
#endif