1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 03:20:00 +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:
Jacob Dahl 2025-01-14 12:36:34 -09:00 committed by GitHub
parent 7a44f1bdce
commit 029f2eea81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;