From 93c2317a5d8ae20f6b3feb13ffc91c3fdc1f2318 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 24 Feb 2026 19:06:21 +0100 Subject: [PATCH 1/2] 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. --- internal_filesystem/lib/drivers/imu_sensor/mpu6886.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal_filesystem/lib/drivers/imu_sensor/mpu6886.py b/internal_filesystem/lib/drivers/imu_sensor/mpu6886.py index 0cf8d137..a7a570c5 100644 --- a/internal_filesystem/lib/drivers/imu_sensor/mpu6886.py +++ b/internal_filesystem/lib/drivers/imu_sensor/mpu6886.py @@ -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) From 4989a961dc3cf759631f9a83103da7d701fe852f Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 24 Feb 2026 20:19:30 +0100 Subject: [PATCH 2/2] waveshare_esp32_s3_touch_lcd_2: Fix soft reset fix soft reset, if machine.SPI.Bus() can't be initialized: do a hrd reset --- .../board/waveshare_esp32_s3_touch_lcd_2.py | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py b/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py index 15a10229..5422523b 100644 --- a/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py +++ b/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py @@ -1,17 +1,15 @@ - print("waveshare_esp32_s3_touch_lcd_2.py initialization") # Hardware initialization for ESP32-S3-Touch-LCD-2 # Manufacturer's website at https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2 -import lcd_bus -import machine -import i2c -import lvgl as lv -import task_handler +import time import drivers.display.st7789 as st7789 import drivers.indev.cst816s as cst816s - +import i2c +import lcd_bus +import lvgl as lv +import machine import mpos.ui # Pin configuration @@ -34,12 +32,17 @@ TP_REGBITS = 8 TFT_HOR_RES=320 TFT_VER_RES=240 -spi_bus = machine.SPI.Bus( - host=SPI_BUS, - mosi=LCD_MOSI, - miso=LCD_MISO, - sck=LCD_SCLK -) + +print("waveshare_esp32_s3_touch_lcd_2.py machine.SPI.Bus() initialization") +try: + spi_bus = machine.SPI.Bus(host=SPI_BUS, mosi=LCD_MOSI, miso=LCD_MISO, sck=LCD_SCLK) +except Exception as e: + print(f"Error initializing SPI bus: {e}") + print("Attempting hard reset in 3sec...") + time.sleep(3) + machine.reset() + + display_bus = lcd_bus.SPIBus( spi_bus=spi_bus, freq=SPI_FREQ,