Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI_Init very slow #676

Open
robkettridge opened this issue Dec 23, 2024 · 1 comment
Open

UI_Init very slow #676

robkettridge opened this issue Dec 23, 2024 · 1 comment

Comments

@robkettridge
Copy link

Hello

We have a project in the works at the moment using EEZ-Studio with LVGL flow on an STM32 processor driving a small 2.5" screen. We have about 20 screens, 6 styles, 2 fonts, 5 small bitmaps. Nothing massively complicated. Just buttons and labels mostly.

The issue we are having is that executing UI_INIT takes about 11 seconds before the interface loads. We would really like to get this down considerably, or at least be able to show something on the screen whilst this is taking place. We're assuming that it's due to LVGL loading everything into RAM from ROM? Does it have to load every screen at start up? Is it possible to load screens on first use?

Are there any settings, or areas we should be looking at to speed this process up? We've done all the optimisations we can think of, and if anything it's getting slower.

Thanks

@mvladic
Copy link
Contributor

mvladic commented Dec 23, 2024

It is true that currently EEZ Studio generates ui_init that will create all the screens in advance. I'm surprised it takes 11 seconds to create 20 screens. Fonts and bitmaps should be used from the ROM, so no preloading to RAM is required, I think.

Did you try to measure how much time it takes for each screen to be created? I think it would be interesting to do that. It can be done like this:

In ui.c modify ui_init:

void ui_init() {
    LV_LOG_USER("START");

    eez_flow_init(assets, sizeof(assets), (lv_obj_t **)&objects, sizeof(objects), images, sizeof(images), actions);

    LV_LOG_USER("END");
}

In screens.c modify create_screens:

void create_screens() {
    ui_create_groups();
    
    eez_flow_init_styles(add_style, remove_style);
    
    eez_flow_init_screen_names(screen_names, sizeof(screen_names) / sizeof(const char *));
    eez_flow_init_object_names(object_names, sizeof(object_names) / sizeof(const char *));
    eez_flow_init_group_names(group_names, sizeof(group_names) / sizeof(const char *));
    eez_flow_init_style_names(style_names, sizeof(style_names) / sizeof(const char *));
    
    lv_disp_t *dispp = lv_disp_get_default();
    lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), false, LV_FONT_DEFAULT);
    lv_disp_set_theme(dispp, theme);

    LV_LOG_USER("init");
    
    create_screen_main();

    LV_LOG_USER("main");

    create_screen_screen_a();
    
    LV_LOG_USER("a");
    
    create_screen_screen_b();

    LV_LOG_USER("b");

    create_screen_screen_c();

    LV_LOG_USER("c");
}

Printout example:

[User]	(0.093, +93)	 ui_init: START ui.c:187
[User]	(0.094, +1)	 create_screens: init screens.c:353
[User]	(0.099, +5)	 create_screens: main screens.c:357
[User]	(0.100, +1)	 create_screens: a screens.c:361
[User]	(0.101, +1)	 create_screens: b screens.c:365
[User]	(0.102, +1)	 create_screens: c screens.c:369
[User]	(0.103, +1)	 ui_init: END ui.c:191

So, in this case ui_init started at 0.093 sec and finished at 0.103 sec. So, 10 ms in total was required to initialize UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants