How can i got the LVGL v9.0 with Micropython v1.22

the lvgl_blings is aligning to Micropyton v1.20.0, but the Micropyton is update to v1.22

It appears that kdschlosser is working on that very thing in his Github repo.

I cloned that repo and its submodules and successfully built an ESP32 SPIRAM image last night. I’m struggling a bit with initializing a display properly as the supplied example isn’t for my display type. I’m running an ili9341.

Yes, with the latest repository, I can’t compile LVGL modules, it may still be in progress, it may have to wait until LVGL adapts to the latest version, the current is v1.20。the ili9341 can be lited? …Maybe you should check that the pins need to change the definition, which may not be the same as the example。

Simple test. LVGL 9.0 ESP32 ili9341

    def lv_example_line_scale(self):

        theme = lv.theme_get_from_obj(lv.screen_active())
        # Create a scale
        scale = lv.scale(lv.screen_active())
        scale.set_size(60, 200)
        scale.set_label_show(True)
        scale.set_mode(lv.scale.MODE.VERTICAL_RIGHT)
        scale.center()

        # Set scale properties
        scale.set_total_tick_count(21)
        scale.set_major_tick_every(5)

        scale.set_style_length(10, lv.PART.INDICATOR)
        scale.set_style_length(5, lv.PART.ITEMS)
        scale.set_range(0, 100)

        # Set custom labels
        # custom_labels = ["0 °C", "25 °C", "50 °C", "75 °C", "100 °C"]
        custom_labels = ["0 C", "25 C", "50 C", "75 C", "100 C"]
        scale.set_text_src(custom_labels)

        # Create and set styles
        indicator_style = lv.style_t()
        indicator_style.init()

        # Label style properties
        indicator_style.set_text_font(theme.font_normal)
        indicator_style.set_text_color(lv.palette_darken(lv.PALETTE.BLUE, 3))

        # Major tick properties
        indicator_style.set_line_color(lv.palette_darken(lv.PALETTE.BLUE, 3))
        indicator_style.set_width(10)      # Tick length
        indicator_style.set_line_width(2)  # Tick width
        scale.add_style(indicator_style, lv.PART.INDICATOR)

        minor_ticks_style = lv.style_t()
        minor_ticks_style.init()
        minor_ticks_style.set_line_color(lv.palette_lighten(lv.PALETTE.BLUE, 2))
        minor_ticks_style.set_width(5)         # Tick length
        minor_ticks_style.set_line_width(2)    # Tick width
        scale.add_style(minor_ticks_style, lv.PART.ITEMS)

        main_line_style = lv.style_t()
        main_line_style.init()
        # Main line properties
        main_line_style.set_line_color(lv.palette_darken(lv.PALETTE.BLUE, 3))
        main_line_style.set_line_width(2) # Tick width
        scale.add_style(main_line_style, lv.PART.MAIN)

        # Add a section
        # Add a section
        section_label_style = lv.style_t()
        section_minor_tick_style = lv.style_t()
        section_main_line_style = lv.style_t()

        section_label_style.init()
        section_minor_tick_style.init()
        section_main_line_style.init()

        # Label style properties
        section_label_style.set_text_font(theme.font_normal)
        section_label_style.set_text_color(lv.palette_darken(lv.PALETTE.RED, 3))

        section_label_style.set_line_color(lv.palette_darken(lv.PALETTE.RED, 3))
        section_label_style.set_line_width(5) # Tick width

        section_minor_tick_style.set_line_color(lv.palette_lighten(lv.PALETTE.RED, 2))
        section_minor_tick_style.set_line_width(4) # Tick width

        # Main line properties
        section_main_line_style.set_line_color(lv.palette_darken(lv.PALETTE.RED, 3))
        section_main_line_style.set_line_width(4) # Tick width

        # Configure section styles
        section = scale.add_section()
        section.set_range(75, 100)
        section.set_style(lv.PART.INDICATOR, section_label_style)
        section.set_style(lv.PART.ITEMS, section_minor_tick_style)
        section.set_style(lv.PART.MAIN, section_main_line_style)

        scale.set_style_bg_color(lv.palette_main(lv.PALETTE.BLUE_GREY), 0)
        scale.set_style_bg_opa(lv.OPA._50, 0)
        scale.set_style_pad_left(8, 0)
        scale.set_style_radius(8, 0)
        scale.set_style_pad_ver(20, 0)


use : for display driver and touch. - GitHub - bdbarnett/mpdisplay: Display, touch and encoder drivers for MicroPython and lv_bindings_micropython
use : for firmware - GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython
Need rename heap_caps add
CleanShot 2024-02-16 at 09.38.06@2x

micropython.cimake
include(${CMAKE_CURRENT_LIST_DIR}/lcd_bus/micropython.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/heap_caps/micropython.cmake)

board_config.py

""" DIY ESP32 psram with and ILI9341 2.8" display and XPT2046 touch controller"""

from lcd_bus import SPIBus
from ili9341 import ILI9341
from machine import Pin, SPI
from xpt2046 import Touch

display_bus = SPIBus(
    dc=5,
    host=1,
    mosi=13,
    miso=12,
    sclk=14,
    cs=15,
    freq=40_000_000,
    wp=-1,
    hd=-1,
    quad_spi=False,
    tx_only=True,
    cmd_bits=8,
    param_bits=8,
    dc_low_on_data=False,
    sio_mode=False,
    lsb_first=False,
    cs_high_active=False,
    spi_mode=0,
)

display_drv = ILI9341(
    display_bus,
    width=240,
    height=320,
    colstart=0,
    rowstart=0,
    rotation=270,
    mirrored=False,
    color_depth=16,
    bgr=True,
    reverse_bytes_in_word=True,
    invert=False,
    brightness=1.0,
    backlight_pin=None,
    backlight_on_high=True,
    reset_pin=4,
    reset_high=False,
    power_pin=22,
    power_on_high=True,
)

spi = SPI(2, baudrate=1000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
touch_drv = Touch(
    spi=spi,
    cs=Pin(25),
    int_pin=Pin(21),
)

#Display rotation 270 degrees, invert Y axis 0b100
touch_drv.calibrate(
    xmin=107,
    xmax=2000,
    ymin=200,
    ymax=1940,
    width=display_drv.height,
    height=display_drv.width,
    orientation=3,
)
touch_read_func = touch_drv.get_touch
touch_rotation_table = (0b000, 0b000, 0b000, 0b100)

lv_config.py

fbuf1 = fbuf2 = None


import lvgl as lv
import lv_driver_framework
from . import board_config

import task_handler
_task_handler = task_handler.TaskHandler()

# Change color_format to match your display
display = lv_driver_framework.DisplayDriver(
    board_config.display_drv,
    lv.COLOR_FORMAT.RGB565,
    fbuf1,
    fbuf2,
    factor=10,
    blocking=True,
)

touch = lv_driver_framework.TouchDriver(
    board_config.touch_read_func,
    rotation=board_config.display_drv.rotation,
    rotation_table=board_config.touch_rotation_table,
)

Also I am try ESP-IDF 5.1.2 with GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython as user_module and pythonSPI driver,

Run make from master micropython.

make -j 9 LV_PORT=esp32 LV_CFLAGS="-DLV_KCONFIG_IGNORE=1" BOARD=STRAGA_CORE_SPIRAM USER_C_MODULES=~/lvgl_micropython/micropython.cmake

That works too.

@straga
I appreciate that you are using MPDisplay and helping others with it. If you don’t mind, I’d like to add your “DIY ESP32 psram with and ILI9341 2.8” display and XPT2046 touch controller" board_config.py to the board_configs directory in MPDisplay so others may use it. I plan to add a table to the README.md listing the full descriptions alongside the directory name. I’ll make sure you are attributed for submitting it. I’ll probably do that next after I finish with some work I’m doing on I80Bus for non-ESP32 platforms.

From what I can tell, the only change you made to lv_config.py is from lv.COLOR_FORMAT.NATIVE to lv.COLOR_FORMAT.RGB565. Did .NATIVE not work for you? I added task_handler a week or so ago, so I think the updated lv_config.py in MPDisplay may work as-is. I’d appreciate your feedback on that and any other issues may have. Feel free to direct message me in this forum if you want.
`

Yes, you can add.

with NATIVE:

CleanShot 2024-02-25 at 10.02.22@2x