i make already one project with the lvgl binding from kdschlosser.
This time, i want to use the lv_micropython.
My hardware:
ILI9341 3.2 TFT, SPI 240x320 V1.0
ESP32 S3 WROOM DEV (with 2 usb ports COM/USB)
Steps:
take linux laptop
sudo apt-get install build-essential libreadline-dev libffi-dev git pkg-config libsdl2-2.0-0 libsdl2-dev python3.8 parallel Python 3 is required, but you can install some other version of python3 instead of 3.8, if needed.
make -C ports/esp32 LV_CFLAGS=ā-DLV_COLOR_DEPTH=16ā BOARD=GENERIC_SPIRAM deploy
my questions:
how i know, the ili9341 have an DLV_COLOR_DEPTH=16 ??
what have some other displays?
i have to git clone micropython too? mpy-cross need this?
how i have to define the spi pins in the micropython programm? can you give an example?
i will use squareline studio for design the UI, is confortable and easy, then export python code and edit (or copy the UI function from the widget out)
i hope, somebody here can assist me a little bit for an next project
When using IL9341 driver, the color depth need to be set to match ILI9341. This can be done from the command line. Here is the command to build ESP32 + LVGL which is compatible with ILI9341 driver:
make -C mpy-cross
make -C ports/esp32 LV_CFLAGS="-DLV_COLOR_DEPTH=16" BOARD=GENERIC_SPIRAM deploy
Explanation about the paramters:
LV_CFLAGS are used to override color depth, for ILI9341 compatibility.
LV_COLOR_DEPTH=16 is needed if you plan to use the ILI9341 driver.
BOARD - I use WROVER board with SPIRAM. You can choose other boards from ports/esp32/boards/ directory.
deploy - make command will create ESP32 port of Micropython, and will try to deploy it through USB-UART bridge.
I make already everything from the ESP-IDF:
my last command was: . ./export.sh
and now? i have to clone the micrpython Repo ? or the lv_micropython Repo ? and make this in any kind together with make -C mpy-cross ?
it would be nice, when somebody can explain is to me (Iām a beginner) and maybe edit the lv_micropython Documentation in the Repoā¦
I have similar questions. After spending 2 days with ChatGPT trying to install for Mac OSX Ventura - I found myself in a never ending loop of incomplete files, make requirements, etc.
While I would love to find out what LVGL can do (Iām working in MicroPython / Pico environment), Iām dead in the water at this point just getting to try it out. Seems like there should be an easier way (not clear from the docs).
After much messing around, I was able to finally get lvgl ārecognizedā on Mac OSX by restarting the instructions, and finding that the lv_micropython ended up being in the directory ./ports/unix/build-standard for my build (adding the build-standard directory). I then linked this with
(Thanks to ChatGPT). I am now able to see lv_micropython and run it from the main shell. In the REPL (>>>) I am able to import lvgl:
import lvgl as lv
And it doesnāt complain (which is great).
BUTā¦
I want to load lvgl into my Pico so I can actually use it with displays. I followed the directions using the make -C mpy-cross then
make -j -C ports/rp2 BOARD=PICO USER_C_MODULES=ā¦/ā¦/lib/lv_bindings/bindings.cmake
to create the firmware.utf (which gets created in ./ports/rp2/build-PICO) and flashed it successfully to the Pico microcontroller.
I fire up Thonny IDE and set my target to the Pico and tested the connection with a Blinky.py program. Then when I attempt to import lvgl as ly, it companies with āno module named lvglā
I must still be missing something fundamental/simple
I had thought the lvgl would be included in the firmware build, but apparently not (or Iām not correctly importing it).
Seems like this all might be easier if there were simply a library to download and import (like we do for display drivers for example), then make sure it is loaded with our other drivers onto our project boards. (or perhaps it is entirely possible that I donāt know enough to know what Iām talking about )
Just signed up here because Iām also interested in using LVGL with Micropython.
Iām not an absolute beginner in electronics and programming but building firmware on Linux in the CLI is beyond my skills. I really have no idea where to start and reading issues above make me refrain from trying anything in the first place.
Donāt get me wrong, Iām not complaining.
Is there maybe something like āa complete idiots guideā or an āexplain it to me like Iām 5 guideā on the topic of building firmware to use LVGL in Micropython?
At this point I feel like a somewhat advanced beginner who lacks the knowledge to progress to more advanced topics.
Hence the reason why I wrote the lvgl_micropython binding. The official one has too many inconsistencies and quirks in it and can be a pain to get running correctly. Itās not cut and dry.
okay, thanks.
When i going to it, if have more questions:
why there are 2 Repos, how they connect together? why is one the sub repo ?
and how i build this everything together?
I think one of the challenges that is confusing people (wellā¦ me at least) is that the documentation seems to jump around between the different repositories (lv_micropythion and lv_binding_micropython), making it extremely likely the reader will get lost and give up.
(Spoiler Alert: I apologize in advance if this sounds like Iām whiningā¦ Iām really not. Iām coming at this from the perspective of a n00b who is interested in helping other n00bs (students age 14 and up) learn to code meaningful projects and noting that it can be extremely confusing and difficult to get from point A to point B in getting up and running )
For example:
Folliwing the instructions at the link you provided (MANY THANKS FOR THAT!!):
I was able to successfully install lv_microptyon and build the firmware.utf for the PICO board. (A previous attempt appeared to create the .utf, but upon BOOTSEL install, it didnāt do anything and did not complain, so I was in the dark as to why it had failed). My second attempt being successful, I loaded it to Pico and tried the sample code in that documentation:
import lvgl as lv
lv.init()
and it ran without complaint. Great! it seems to be recognized and working! Iām on the way!
The next instruction:
" Then event loop, display driver and input driver needs to be registered. Refer to Porting the library for more information. Here is an example of registering SDL drivers on Micropython unix port:
# Create an event loop and Register SDL display/mouse/keyboard drivers.
from lv_utils import event_loop
"
Up to this point there hasnāt been mention of the lv_utils.py library file, so adding this line to a test file fails as the lv_utlis library is not found.
And so begins the wild adventure through documentation that bounces between the C and MicroPython sites, passing through various pages, offshoots, opening browser tabs (some for pages already open).
Eventually (I think it was after a google search) I found lv_utils.py on GitHub in the āotherā repository for lv_binding_micropython:
(Iām still not sure how I actually found it.) Do I now pul that entire lib directory into my project even though I found it at lv_bindings_micropython instead of lv_micropython?
Copying the lv_utils to my project file helped n that it satisfied the IDE that the library is no longer missing, but I havenāt any idea if that means Iām good to go or if there will be (many) more similar excursions before I get to a functional .py file.
I hope this sheds some light as I know once youāve been working in a paradigm for a while, learning much along the way, it can be difficult to remember what the absolute n00b is facing, possibly with less baseline understanding about what is going on.