Modulo Esp32-2432S08 (ili9341+xpt2046) problem touch

The solution is to use the lvgl patch that hasnt been merged yet:

You need to cd into the lib/lv_bindings directory and type:

gh pr checkout 340

(sudo apt install gh and authorizing your github account may be needed)
Then get out of your lv_micropython, and build it again, deploy it in the ESP32-2432S08

Then, change the python code above to:

import lvgl as lv
import espidf as esp

lv.init()

# Import ILI9341 driver and initialized it

from ili9XXX import ili9341

disp = ili9341(miso=12,
               mosi=13,
               clk=14,
               cs=15,
               dc=2,
               rst=-1,
               power=-1,
               backlight=21,
               backlight_on=1,
               spihost=esp.HSPI_HOST,
               spimode=0,
               width=240,
               height=320,
               mhz=40,
               factor=8,
               hybrid=True,
               half_duplex=True,)

# Import XPT2046 driver and initalize it
from xpt2046 import xpt2046_softspi as xpt2046
touch = xpt2046(miso=39,
                mosi=32,
                clk=25,
                cs=33,
                spihost=esp.VSPI_HOST,
                mhz=2,
                max_cmds=16,
                cal_x0 = 3783,
                cal_y0 = 3948,
                cal_x1 = 242,
                cal_y1 = 423,
                transpose = True,
                half_duplex=True,
                samples = 3)

def button_cb(e):
    print(f"lv.EVENT: {e.get_code()}")

scr = lv.obj()
btn = lv.button(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text('Hello World!')
lv.screen_load(scr)

Remember to reset your board first, to prevent low DMA errors.

Refer to this solution to change to landscape

1 Like