Fix touch orientation

This commit is contained in:
Thomas Farstrike
2025-04-19 01:01:22 +02:00
parent dd33a8a6c8
commit 112ef9b0a3
+12 -6
View File
@@ -113,19 +113,25 @@ display = st7789.ST7789(
display.set_power(True)
display.init()
display.set_rotation(lv.DISPLAY_ROTATION._90)
display.set_backlight(100)
i2c_bus = i2c.I2C.Bus(host=0, scl=47, sda=48, freq=100000, use_locks=False)
touch_dev = i2c.I2C.Device(bus=i2c_bus, dev_id=0x15, reg_bits=8)
#indev = cst816s.CST816S(touch_dev) # button in bottom right corner iso top left
#indev=cst816s.CST816S(touch_dev,startup_rotation=lv.DISPLAY_ROTATION._90) # button in bottom right iso top left
indev=cst816s.CST816S(touch_dev,startup_rotation=lv.DISPLAY_ROTATION._180) # button in top left, good
th = task_handler.TaskHandler()
display.set_rotation(lv.DISPLAY_ROTATION._90)
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x000000), 0)
# Create a button (using lv.obj as a base)
btn = lv.obj(scr)
btn.set_size(100, 50)
btn.align(lv.ALIGN.CENTER, 0, 0)
btn.align(lv.ALIGN.LEFT, 20, 20)
# Add button style
style = lv.style_t()
@@ -185,12 +191,12 @@ knob_style.set_pad_all(5)
slider.add_style(knob_style, lv.PART.KNOB)
show_block_height()
#show_block_height()
# Connect to Wi-Fi and fetch block height
if connect_wifi():
else:
label.set_text("Block Height: Wi-Fi Error")
#if connect_wifi():
#else:
# label.set_text("Block Height: Wi-Fi Error")