Multiple Displays


I would like to use 2 or 3 physical displays. For example the main display to configure parameters, while another display shows a permanent set of measured values. How can I archive this? If I create multiple projects the exported files and functions are named always ui_something which will result in conflicts.

Hi, I do not think that this is question for SLS, but rather LVGL forum. You can make whatever screen in your LS project, but when you are running your code on your device, you have to initialize and drive multiple displays and after that assign you screen from SLS project to desired display.

Here is result for search at LVGL forum.

I hope that make sense to you and will help you.

Actually, LVGL supports multiple displays. All you need to is creating 3 LVGL displays and calling lv_disp_set_default(some_disp). After that LVGL will create all the widgets on the selected display. See here.

However SLS will really export e.g. ui_init() for all 3 projects. And it will also export all ui_helpers, which will really conflict.

So in short, multi-display development is not supported now. :frowning:

I’ve moved this topic to the feature request category.

Ok, so basically I would have to generate 2 Studio projectes. Each for one of my displays. Afterwards I will have to rename all files and functions to a different name like ui2xxx and use those as reference for the second display I need to create in my controller’s software.

If displays is same size, then maybe you can create screens in one SLS project and use onload call on primary display to load screens to others. But yes perfect will be supported.

Yes, it’s quite cumbersome, but I have no better idea. :frowning:

@kisvegabor One question. Is possible in flush_cb get id for screen better name actualy rendered? This may be helpfull for multidisplay designed in SQL.
Second question is input focus. What lvgl do if in loaded screen 1 i call _ui_screen_change(ui_Screen2, LV_SCR_LOAD_ANIM_MOVE_LEFT, 200, 0);

and screen2 is on display2.?

There is no dedicated built-in method for that you can use e.g. lv_obj_set_user_data(scr1, "name1")

I don’t really understand it. How do you mean “What lvgl do”? For what do you mean it?

I need get method not set, and get relevant to actual parea not screen.

Q2. On real two scr is active on two displays. WHo and how get focus.?

Maybe I explain more if I choice this :

Split image

You can create a larger virtual display from an array of smaller ones. You can create it as below:

  1. Set the resolution of the displays to the large display’s resolution.
  2. In drv.flush_cb , truncate and modify the area parameter for each display.
  3. Send the buffer’s content to each real display with the truncated area.

and in Squareline create screens sized for real display ( no larger ) in flush_cb I send it to one or other display. But I need detect from witch screen is p_area data. (can patch lvgl code , but need help where)


In teory I can use lv_scr_act(),

but if on display 1 is started some animation and I load screen 2 for display 2 , flush cb continue animation and mix areas I mean, I don’t test now.

I now have an running demo of my two displays. But I encounter a funny phenomenon.

Ui1 has an roller and an arc
Ui2 has 2 progress bars but no roller

If my draw order is Ui2 before Ui1 everything is fine
If I draw Ui1 before Ui2 the roller background color changes. Normally it should be a light grey, now it is white. All other elements remain unchanged and besides this, the display graphics is working as intended.

My first guess would have been that I missed renaming a function for the second Ui project. But since there is no roller in the second Ui at all I’m clueless what could change the background color of the first Ui roller.

I have found the culprit for this latest behaviour.

After reading through some code I just found that I do not set any background for the roller. But than why was the roller background gray in the first place? So I went back into Squarline Studio and for the first ui a new roller was always gray and for the second ui white. Turns out that is the behaviour of the theme you select. The first ui I had created with the dark themen, hence the gray roller background. For the second ui the theme was light.

So the problem was, that I did rename all of the functions but in the ui_init I was using the same object for the structurs in both ui_init function calls. And therefore overwriting the theme setting by darwing the second ui, which of course influenced the first drawn screen as well.

Now how to fix this? Here are some ways that I came up with
Set a background color for the ruler. In this case the theme setting is ignored.
Use the same theme for both displays. Overwriting the struct member with the same information then.
Initialize a second struct member for the theme.

And the best solution would be a nearby release of the feature request to create a multi display project in squareline :wink:

I’m not sure I perfectly understand the problem, but I think it should help to understand what happens.
So this is how ui_init() looks like:

    lv_disp_t * dispp = lv_disp_get_default();
    lv_theme_t * theme = lv_theme_XXXXX_init(dispp);
    lv_disp_set_theme(dispp, theme);
    ui____initial_actions0 = lv_obj_create(NULL);

This gist is that it gets the default display, and sets the theme on it. Unless you change it, the default display is the display you create first. So you should set the default displays explicitly like this in order to set the themes on in its ui_init():