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
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:
thanks, that is very interesting
@straga very interessting!!!
i try the build kdschlosser lvgl project, this was successful. But after i flash it to my esp32 s2 mini, the control not start again… something is buggy there, i canot figure out the exact issue, that why i opened only a disussion talk in the github repo, but him not replay.
so - i’m not an expert, but your solution is more clear. You define the display pins to the esp32 pins, thats makes sense (i missed this in the lvgl-micropyhton project from kdschlosser).
Can you make a video or a tutorial how you do it step by step???
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
what exactly you use? and how you build the *.bin version? with make from kdschlosser???
To much changed now. But with some change firmware can build with New SPI and Micropython SPI. firmware only lvgl+Micropython SPI still all work mp1.24 + lvgl 9.1 but need use very old mpdisplay with python SPI driver.
C lcd_spi when activate LCD work without error, but LCD not render any.
Other way not works. I am ask about that.
Now work. I want create some repo with info about how to…
Possible build firmware with lvgl from (GitHub - lvgl-micropython/lvgl_micropython: LVGL module for MicroPython) with user_module in Main python repo.
Just need do some extra by hand. Now tested with isp-idf 5.2.2 with mpy 1.24 preview + lvgl 9.1. Work LCD and Touch: ESP32 psram with and ILI9341 2.8” display and XPT2046. Also works asyncio task from push button on LCD.
hello, thank you for your replay! i see you in the micropython discord … but offline.
hmmmm, whats your building command??
i try it with this:
python3 make.py esp32 submodules clean mpy_cross BOARD=LOLIN_S2_MINI BOARD_VARIANT=SPIRAM DISPLAY=ILI9341 INDEV=gt911
but then i get an error and this making command want to flash the esp automatic too (i have some problems with the usb driver on the linux laptop …
so, today was not successful, but i not give up
No I build from micropython esp32 dir:
make -j 9 SECOND_BUILD=0 LV_PORT=esp32 LV_CFLAGS=“-DLV_KCONFIG_IGNORE=1” BOARD=STRAGA_CORE_SPIRAM USER_C_MODULES=~/Documents/dev_iot/opt/upy/cmodules/lvgl/lvgl_micropython/ext_mod/micropython.cmake
But before you need create own board and copy file for new C SPI, and create some expty *.h files.
I build with out frozen inside. I am put late need file.
Has anyone else gotten the SDL display to work for the unix port on this? Unix port failing on sdl_display object creation · Issue #113 · lvgl-micropython/lvgl_micropython · GitHub All I see is a black screen on all my machines. I know kdschlosser has it working in a VM on his machine, but I for the life of me can’t figure out what is happening.
The problem has been fixed. It is working now.