-
Notifications
You must be signed in to change notification settings - Fork 111
Q&A
When creating a new LVGL project there are two main options:
The difference between these templates is that one uses EEZ Flow and the other does not.
With EEZ Flow you can implement basic logic of your application, like changing screens, setting widget properties and working with variables. When you decide to use EEZ Flow please note that you must link with the eez-framework library.
If you don't want to use EEZ-Flow you can still define variables that can update Widget content and user actions that can be attached to event handlers.
-
Build the project with EEZ Studio - there is a Build icon in toolbar.
Source files will be placed by default in folder
src/ui
relative to the youreez-project
file. This can be changed in "Settings - Build". -
Add generated source files into your project C++ project. If EEZ Flow is used then C++ compilation is required.
-
During setup, after
lv_init()
, callui_init()
declared insrc/ui/ui.h
-
During loop, after
lv_task_handler()
orlv_timer_handler()
, callui_tick()
Check the native-interface-lvgl-no-flow example. There is a Readme file with the explanations:
Check the native-interface-lvgl-with-flow example. There is a Readme file with the explanations:
Native stands for "implemented in C or C++" - i.e. not managed/implemented by the EEZ Flow engine.
We support "native variables" where get variable and set variable functions must be implemented in C or C++ by you as opposed to the flow variables where they are managed by the flow engine (still you can access these variables from your native, i.e. C or C++ code).
Also, we support "native user actions" where action is implemented in C or C++ as opposed to the user actions that are implemented by using EEZ Flow.
After adding a Button to the page, on clicking it the properties in general tab show only name, no field for label is there.
You need to add Label as a child to Button like this:
Why I'm getting "fatal error: lvgl/lvgl.h: No such file or directory" when compiling Studio generated source files?
Depending on the build system/configuration, lvgl.h
can be included either as lvgl/lvgl.h
or just lvgl.h
(when LV_LVGL_H_INCLUDE_SIMPLE
is defined). There is an option in Settings - Build to select this for generated files:
You are missing either flow_def.c
or //${eez-studio LVGL_NATIVE_VARS_TABLE_DEF}
inside that file:
When you create a new "LVGL with EEZ Flow" project everything is already there. But, if you opened some old project it is possible that something is missing. Also if you converted LVGL project without EEZ Flow support by click this:
then you will not have correct file templates (this is already reported #366 and #377). So, to be sure that everything is there you can copy all the file templates from a newly created project and paste it into your project:
- Make sure you do have a most recent file templates from which source code is generated - check the previous question.
- Make sure you define EEZ_FOR_LVGL, check this.
Yes. You will need eez-framework library. Check #361.
You need to enable fonts in lv_conf.h
:
Why "Transform zoom" style doesn't work on my device where in Studio simulator (Run button) it works?
Not all hardware supports all the features available in LVGL. This depends on display driver capabilities and/or lv_conf.h
settings. Please, ask the question on LVGL forum about your hardware platform capabilities.
Let say you have flow variable called slider_var
. In your vars.h
file you will have:
enum FlowGlobalVariables {
FLOW_GLOBAL_VARIABLE_SLIDER_VAR = 0
};
Here is how you can access this integer value from C++ (or INO file if you are on Arduino):
...
#include "ui.h"
#include "vars.h"
#include "structs.h"
...
int getSliderVar() {
return flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_SLIDER_VAR).getInt();
}
...
For other C++ variable types (bool
, const char *
, float
and double
):
flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR).getBoolean();
flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR).getString();
flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR).getFloat();
flow::getGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR).getDouble();
First read the previous question.
Now, to set integer global variable use:
flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_SLIDER_VAR, IntegerValue(slider_var));
For other C++ variable types (bool
, const char *
, float
and double
):
flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR, BooleanValue(my_var));
flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR, StringValue(my_var));
flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR, FloatValue(my_var));
flow::setGlobalVariable(FLOW_GLOBAL_VARIABLE_MY_VAR, DoubleValue(my_var));
https://github.com/eez-open/esp32-lvgl-eez-demo
If you are getting build errors (like: Error generating bitmap 'ui_image_xxx.c' file: Error spawn python ENOENT
) regarding image conversion:
Then check this and this.
Is there a way to extract LVGL event data (for example: event code, target, user data, key, ...) using EEZ Flow?
Yes, check this.
Video tutorial: ARDUINO IDE + ESP32 + TFT LCD Touchscreen + LVGL + EEZ Studio | Getting started EEZ Studio and ESP32
https://www.youtube.com/watch?v=4k013Crfce8
Check this:
Also, new in version 0.14.0: