Fix MPU6886 X-Axis

MPU6886 is part of M5Stack FIRE. I compare the values from this device with Waveshare
ESP32-S3-Touch-LCD-2: The X-axis values are inverted. Fix this here.
This commit is contained in:
JensDiemer
2026-02-24 19:06:21 +01:00
parent 29a5465992
commit 93c2317a5d
@@ -59,7 +59,7 @@ class MPU6886:
def _read_xyz(self, reg: int, scale: float) -> tuple[int, int, int]:
data = self.i2c.readfrom_mem(self.address, reg, 6)
x = twos_complement(data[0] << 8 | data[1], 16)
x = twos_complement(data[0] << 8 | data[1], 16) * -1
y = twos_complement(data[2] << 8 | data[3], 16)
z = twos_complement(data[4] << 8 | data[5], 16)
return (x * scale, y * scale, z * scale)