lv_gui_builder
lv_gui_builder copied to clipboard
Build-time configuration needs to be adjustable at run-time
When building for GUI builder, certain parameters of the LittlevGL configuration should be adjustable at run-time. Some examples include:
- Display resolution
- Color depth
- Cursor blink speed
Additionally, all modules must be enabled for use by the GUI builder.
I have to look a bit deeper to see how complicated it would be to change things like the display resolution at run-time. Some things will likely require an entire restart of the lvgl rendering system.
It could be useful to introduce a new preprocessor macro that will enable modules such as:
#if USE_LV_ARC != 0 || GUI_BUILDER_BUILD
@AGlass0fMilk Work is already being done to upgrade LittlevGL to dynamically handle rotation/multiple displays, which should solve that part of the problem: https://github.com/littlevgl/lvgl/issues/329
Aa @embeddedt mentioned a lot of formerly defined parameters will be (or already) reworked to be run-time settable.
It could be useful to introduce a new preprocessor macro that will enable modules such as: #if USE_LV_ARC != 0 || GUI_BUILDER_BUILD
We should have 2 lv_conf.h:
- for the Python binding. Here everything should be enabled to add all options to the editor. The user has nothing to do with that.
- and other for the exported GUI code. Here some options can be automatically disabled when they are not used in the editor.
@kisvegabor It's been a while but I read through some of the issues in lvgl and it seems this requirement is complete in the dev-6.0 feature branch? Is that correct?
I am working on updating the pylvgl binding to lvgl 6.0, see https://github.com/rreilink/pylvgl/issues/3
It's been a while but I read through some of the issues in lvgl and it seems this requirement is complete in the dev-6.0 feature branch? Is that correct?
Yes, we turned all possible hard-coded settings to run-time configuration. So I think we can close this issue.
I am working on updating the pylvgl binding to lvgl 6.0, see rreilink/pylvgl#3
Awesome! We are planning to release v6.0 in June so there is some time to update things if necessary.
@kisvegabor could you briefly go over what "all possible hard-coded settings" are and what API(s) have been introduced to alter them at run-time?
@AGlass0fMilk
-
Most of the display-related settings (resolution, buffer size, etc.) are now configured at runtime. This should give you an idea: https://github.com/littlevgl/lvgl/blob/dev-6.0/porting/lv_port_disp_template.c
-
- However, there is now a hardcoded maximum display size, though we could just set it to a reasonable value for a typical embedded platform (i.e. I see little need to go beyond 1024x768).
-
A similar concept was applied for input devices, though they have always been configurable at runtime.
-
As @kisvegabor mentioned, we can just enable all feature-related options with a separate
lv_conf.hfor the GUI builder. That way those settings don't need to be altered at runtime.
The only remaining hardcoded settings besides those that would be worth changing IMO are:
LV_COLOR_TRANSP: This probably needs to be made into a runtime setting, because it would depend on the application being built. I don't think this would be difficult to change.- Possibly the text settings.
- The cursor blink and pasword show times for the text area.
The other hardcoded settings are outside of the scope of the GUI builder (things like color depth and memory management).
@AGlass0fMilk Have look at these structs to see the run time configurable parameters:
- Display: https://github.com/littlevgl/lvgl/blob/dev-6.0/src/lv_hal/lv_hal_disp.h#L59
- Indev: https://github.com/littlevgl/lvgl/blob/dev-6.0/src/lv_hal/lv_hal_indev.h#L71
@embeddedt
LV_COLOR_TRANSP: This probably needs to be made into a runtime setting, because it would depend on the application being built. I don't think this would be difficult to change.
We can make it configurable for each display if you find it reasonable.
Possibly the text settings.
It could be possible too to store these values in variables and pointers and use the defines as default values.
The cursor blink and pasword show times for the text area.
We can turn them object specific properties and use the defines as default values here too.
I just saw something which can be problematic.
See LV_USE_EXT_CLICK_AREA. This define replaces a function with an other. Fortunately, there aren't so many cases like this.
Here the solution could be to enable both functions and hide the #if LV_USE_EXT_CLICK_AREA == ... part inside them.
This define replaces a function with an other. Fortunately, there aren't so many cases like this. Here the solution could be to enable both functions and hide the #if LV_USE_EXT_CLICK_AREA == ... part inside them.
Why not just enable the full API (with padding for all sides) and if the tiny version is used, use the larger of the two values?
It would work somewhat like this:
/**
* Set the size of an extended clickable area
*
* If TINY mode is used, only the largest of the horizontal and vertical padding
* values are considered.
*
* @param obj pointer to an object
* @param left extended clickable are on the left [px]
* @param right extended clickable are on the right [px]
* @param top extended clickable are on the top [px]
* @param bottom extended clickable are on the bottom [px]
*/
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom)
{
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
obj->ext_click_pad.x1 = left;
obj->ext_click_pad.x2 = right;
obj->ext_click_pad.y1 = top;
obj->ext_click_pad.y2 = bottom;
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
obj->ext_click_pad_hor= LV_MATH_MAX(left, right);
obj->ext_click_pad_ver = LV_MATH_MAX(top, bottom);
#endif
}
The advantage of this setup is that regular users no longer need to adjust their code if they change that config setting.
@embeddedt I updated it as you suggested https://github.com/littlevgl/lvgl/commit/d3d9fde2451d266aab9a4117e41eaa405116abf8
If you agree I can make LV_COLOR_TRANSP, text, and Text area setting run-time configurable.
@kisvegabor Excellent! That's exactly what I was thinking!
I updated LV_COLOR_TRANSP, LV_TA_CURSOR_BLINK_TIME and LV_TA_PWD_SHOW_TIME.
See https://github.com/littlevgl/lvgl/commit/b0fffaa55b52e517ddac4c66f7044dff24b0fffd