ESP32 LVGL Graphics Library

For general Flowcode discussion that does not belong in the other sections.
mnfisher
Valued Contributor
Posts: 1279
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

Re: ESP32 LVGL Graphics Library

Post by mnfisher »

There is some supplementary code. I've pulled most to macros - and I think most of the rest could also be moved apart from the #includes

Using different displays.

Some displays have code builtin to lvgl (see the first post in this topic for use of st7789) - the need code to send a command (with data) and data to the display. I didn't need to modify the lvgl lv_delay code here as I use FC delays for initialising the display.

The ili9488 isn't supported - so needs a 'flush' to send data to a specified 'window' and an initialisation routine. I've used my own here - the board uses A0..A15 to send parallel data.

lvgl supports multiple displays (the actual hardware) not to be confused with screens (what is displayed - I demonstrate this with the keyboard)

Displaying a jpg is as simple as:

Code: Select all

  lv_obj_t * img1;
  img1 = lv_img_create(lv_scr_act());
  lv_obj_align(img1, LV_IMAGE_ALIGN_CENTER, 0, 0);
  lv_img_set_src(img1, "A:/storage/wrens3.jpg");
Note that the jpg decoder is enabled in the lv_conf - if using littlefs (there is a partition set in the sample partitions.csv) then add

Code: Select all

littlefs_create_partition_image(storage D:/Projects/Flowcode/Images FLASH_IN_PROJECT)
to main/cmakelists.txt

I didn't get the littlefs support working correctly (and use stdio commands to access the files) - might need some more playing..

Touch works well - for example I tried the bar with a user adjustable position and the calendar widget.

I've barely scratched the surface of lvgl here - there a huge range of styles and widgets - and I have only combined a few (for example a label, roller and button for the initial screen) Have fun!

Ben - how do you turn off the (superbright) LED on the back of the board?

Martin

mnfisher
Valued Contributor
Posts: 1279
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

Re: ESP32 LVGL Graphics Library

Post by mnfisher »

A couple of other tips.

Use the fastest upload speed you can - I use 921600 but you might get away with 2* this. I changed flowcode's upload to use this speed too.

When flashing from a command line

Idf.py -p COM5 - b 921600 flash

This will also rebuild the program if needed.

Note that it is quicker to build from the command line - flowcode runs export (more than once) but you need to compile to C to create the new file to compile.

This compiled to quite a large program (>1MB) so I altered the partition sizes (the S3 has more space) I didn't try optimising for size....

mnfisher
Valued Contributor
Posts: 1279
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

Re: ESP32 LVGL Graphics Library

Post by mnfisher »

See https://squareline.io/ for SquareLine studio - which makes it very easy to design layouts. The code can be cut and pasted into a code block with minor changes (need to declare the variables types (or use the headers). I just tried the 'spinner' widget and working perfectly...

WYSIWYG layout / style etc - very easy to use (and free for personal use!)

Martin

Chadb
Posts: 73
Joined: Fri Dec 18, 2020 1:15 pm
Has thanked: 32 times
Been thanked: 1 time

Re: ESP32 LVGL Graphics Library

Post by Chadb »

I was just coming here to post this. I was thinking maybe we are barking up the wrong tree. Maybe we should be figuring out how to better integrate getting squareline into flow code.

Chad

Edit: can you post your sample file?

Chadb
Posts: 73
Joined: Fri Dec 18, 2020 1:15 pm
Has thanked: 32 times
Been thanked: 1 time

Re: ESP32 LVGL Graphics Library

Post by Chadb »

Hey, doing some digging.

So it looks like squareline is an offshoot of this. It is free and open source and looks to do about the same for free without the limitations.
Probally isn't as polished but... I am trying to get a test running on Arduino IDE this weekend.
https://www.envox.eu/studio/studio-introduction/

chad

mnfisher
Valued Contributor
Posts: 1279
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 122 times
Been thanked: 643 times

Re: ESP32 LVGL Graphics Library

Post by mnfisher »

Looks good - will have a play on return from my travels.

I think it generates lvgl code in the same manner so will still need the lvgl 'glue' shown above.

Let us know how it goes...

Martin

Post Reply