Skip to content
Martin Vladić edited this page Jun 2, 2024 · 43 revisions

LVGL

What is difference between "LVGL" and "LVGL with EEZ Flow" project templates?

When creating a new LVGL project there are two main options:

image

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.

How variables and user actions works in project without EEZ Flow?

Check the native-interface-lvgl-no-flow example. There is a Readme file with the explanations:

image

How native variables and native user actions works in project with EEZ Flow?

Check the native-interface-lvgl-with-flow example. There is a Readme file with the explanations:

image

What does native stand for? What's the opposite thing?

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:

image

lvgl_button_test.zip

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:

image

How to fix an error "undefined reference to native_vars" in file /eez/core/value.cpp?

You are missing either flow_def.c or //${eez-studio LVGL_NATIVE_VARS_TABLE_DEF} inside that file:

image

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:

image

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:

image

How to fix an error "ui.c:7:1: error: unknown type name 'ActionExecFunc'"?

Can I use EEZ Flow in my Arduino project?

Yes. You will need eez-framework library. Check #361.

I'm getting error "ImportError: Need pypng package" when building project for LVGL 9.0?

Check this.

Why system font is not visible on my device where in Studio simulator (Run button) is visible?

You need to enable fonts in lv_conf.h:

image

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.

How to get value of flow variable in my C++ code?

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();

How to set value of integer flow variable in my C++ code?

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));

How to reduce memory consumption when EEZ Flow is used?

Check this

Dashboard

Can I work with JSON?

Check this:

Also, new in version 0.14.0:

EEZ Framework

Where can I download eez-framework library?

https://github.com/eez-open/eez-framework

Clone this wiki locally