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:
parent
13d1dc81ce
commit
4c86e31d1e
1 changed files with 1 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue