mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Per @martinbudden 's formula
This commit is contained in:
parent
6e2feb5dce
commit
38b90c69fe
1 changed files with 11 additions and 6 deletions
|
@ -738,14 +738,19 @@ 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;
|
||||
|
||||
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++) {
|
||||
if (scale) {
|
||||
sbufWriteU16(dst, acc.accSmooth[i] / scale);
|
||||
} else {
|
||||
sbufWriteU16(dst, acc.accSmooth[i] * 2);
|
||||
}
|
||||
sbufWriteU16(dst, acc.accSmooth[i] / scale);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sbufWriteU16(dst, gyroRateDps(i));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue