Skip to content

Commit

Permalink
Fixed incorrect accelerometer scaling in MSP (betaflight#13026)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviopinzarrone authored and davidbitton committed Feb 5, 2024
1 parent 1878467 commit 6860bd3
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/main/msp/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6860bd3

Please sign in to comment.