lvgl / lv_demos

Examples, tutorials and applications for the LVGL embedded GUI library
https://lvgl.io
488 stars 366 forks source link

update to work with Arduino #104

Closed ataweg closed 3 years ago

ataweg commented 3 years ago

I made the lv_demo_widgets from lv_examples buildable with the Arduino IDE for an ESP32 board and a 480x320 display. I also update the lvgl library. Most changes were done by text replacements:

1) replace _#if defined(LV_LVGL_H_INCLUDESIMPLE) with _#if defined(LV_LVGL_H_INCLUDESIMPLE) || defined( ARDUINO )

2) replace _#include <lv_examples/lvdemo.h> with _#ifdef ARDUINO

include

#else
   #include <lv_examples/lv_demo.h>
#endif_

3) replace e == with e->code ==

ataweg commented 3 years ago

I forgot to say to set in the lvconf.h file: #define LV_MEMSIZE (48U 1024U) /[bytes]*/ Otherwise, due to insufficient memory, only a small strip will be shown on the display and nothing else will happen.

ataweg commented 3 years ago

You are right, it can work without it. I am not a friend of platform.local.txt because it is not assigned to a project/sketch, but to a processor or board. As long as I can't find a better solution, I have to put a platform.local.txt file in the ESP32 hardware folder with the following content: _compiler.c.extra_flags =-DLV_LVGL_H_INCLUDE_SIMPLE compiler.cpp.extra_flags =-DLV_LVGL_H_INCLUDESIMPLE

Hmm, maybe this knowledge should be included in the documentation for the Arduino users? But who likes to write docs? Then you better leave the ARDUINO define in the source code. It's also easier for the casual Arduino programmer.

embeddedt commented 3 years ago

In my opinion, adding a note to the documentation is preferable. So far we have generally avoided adding platform-specific flags, except in common files where it only needs to added in one place.

@kisvegabor What do you think?

RudyFiero commented 3 years ago

In my opinion, adding a note to the documentation is preferable.

Will this note be clear enough for the average Arduino user? I am currently struggling with a touch panel library that has extensive documentation. And if someone were able to go through the code, making use of the documentation, they could figure out what the code is doing. I'm sure it was clear in the mind of the programmer, who can no longer understand what the average user (not professional programmer) has to deal with.

I have spent a lot of hours trying to get lvgl to run examples under Arduino. All because it wasn't clearly defined what needed to be done.

embeddedt commented 3 years ago

I think (although I'm not an average user as you've noted) it's reasonable to expect someone to read the Get started section of the documentation. We could add a note to the Arduino portion of that section about this macro needing to be defined.

RudyFiero commented 3 years ago

it's reasonable to expect someone to read the Get started section

I agree totally. But often what seems to be clear in the programmer's mind is not at all clear to someone with less experience.

This project is already cumbersome to get going. All I'm saying is if you are going to be adding additional instructions, please make sure it is clear where and how to make the required changes.

RudyFiero commented 3 years ago

https://github.com/lvgl/lv_examples#widgets

LVGL has more than 35 widgets and you can find examples for all of them. Go to the lv_ex_widgets folder to see them.

The link address for lv_ex_widgets is wrong. https://github.com/lvgl/lv_examples/tree/master/src/lv_ex_widgets returns a 404 error.

This is just one example.

kisvegabor commented 3 years ago

@ataweg I hope this will help to avoid the usage of ARDUINO define.

The link address for lv_ex_widgets is wrong. https://github.com/lvgl/lv_examples/tree/master/src/lv_ex_widgets returns a 404 error.

We are updating to lvgl v8 and not every part is finished yet. E.g. README still needs to be updated.

embeddedt commented 3 years ago

Hmm... looks like the diff here is no longer relevant. I assume we can close this as lvgl/lvgl#2200 was merged?

kisvegabor commented 3 years ago

Here @ataweg said v8 works now with Arduino, so let's close it.

Thank you for the contributon.