mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
mag: lis2mdl: fix axes (#14155)
* mag: lis2mdl: fix axes from LH to RH, match LIS3MDL axes * fix spelling Co-authored-by: Mark Haslinghuis <mark@numloq.nl> --------- Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
parent
7a44f1bdce
commit
029f2eea81
1 changed files with 9 additions and 3 deletions
|
@ -136,9 +136,15 @@ static bool lis2mdlRead(magDev_t * mag, int16_t *magData)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
magData[X] = (int16_t)(buf[1] << 8 | buf[0]);
|
int16_t x = (int16_t)(buf[1] << 8 | buf[0]);
|
||||||
magData[Y] = (int16_t)(buf[3] << 8 | buf[2]);
|
int16_t y = (int16_t)(buf[3] << 8 | buf[2]);
|
||||||
magData[Z] = (int16_t)(buf[5] << 8 | buf[4]);
|
int16_t z = (int16_t)(buf[5] << 8 | buf[4]);
|
||||||
|
|
||||||
|
// adapt LIS2MDL left-handed frame to common sensor axis orientation (match LIS3MDL)
|
||||||
|
// pin 1 mark becomes +X -Y
|
||||||
|
magData[X] = -x;
|
||||||
|
magData[Y] = y;
|
||||||
|
magData[Z] = z;
|
||||||
|
|
||||||
pendingRead = true;
|
pendingRead = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue