# Multiple Displays

**URL:** <http://forum.squareline.io/t/multiple-displays/1116>\
**Category:** Feature requests\
**Created:** [April 6, 2023, 6:02pm UTC](http://forum.squareline.io/t/multiple-displays/1116 "2023-04-06T18:02:58Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deadeye](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@Deadeye](http://forum.squareline.io/u/Deadeye)\
**Post date:** [April 6, 2023, 6:02pm UTC](http://forum.squareline.io/t/multiple-displays/1116/1 "2023-04-06T18:02:58Z")

</div>

Hello,

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.

---

<div class="post-metadata">

**Author:** ![dronecz](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/49beb7/32.png) [@dronecz](http://forum.squareline.io/u/dronecz)\
**Post date:** [April 9, 2023, 12:18pm UTC](http://forum.squareline.io/t/multiple-displays/1116/2 "2023-04-09T12:18:45Z")

</div>

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](https://forum.lvgl.io/search?q=multiple%20display) for search at LVGL forum.

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

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [April 11, 2023, 7:56am UTC](http://forum.squareline.io/t/multiple-displays/1116/3 "2023-04-11T07:56:27Z")

</div>

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](https://docs.lvgl.io/8.3/overview/display.html#multiple-display-support).

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. ☹

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

---

<div class="post-metadata">

**Author:** ![Deadeye](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@Deadeye](http://forum.squareline.io/u/Deadeye)\
**Post date:** [April 11, 2023, 8:41am UTC](http://forum.squareline.io/t/multiple-displays/1116/4 "2023-04-11T08:41:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marian\_M](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@Marian\_M](http://forum.squareline.io/u/Marian_M)\
**Post date:** [April 11, 2023, 4:51pm UTC](http://forum.squareline.io/t/multiple-displays/1116/5 "2023-04-11T16:51:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [April 12, 2023, 12:57pm UTC](http://forum.squareline.io/t/multiple-displays/1116/6 "2023-04-12T12:57:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Marian\_M](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@Marian\_M](http://forum.squareline.io/u/Marian_M)\
**Post date:** [April 16, 2023, 6:35am UTC](http://forum.squareline.io/t/multiple-displays/1116/7 "2023-04-16T06:35:51Z")

</div>

@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.?

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [April 17, 2023, 11:40am UTC](http://forum.squareline.io/t/multiple-displays/1116/8 "2023-04-17T11:40:20Z")

</div>

> [@Marian\_M](#):
>
> One question. Is possible in flush\_cb get id for screen better name actualy rendered? This may be helpfull for multidisplay designed in SQL.

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

> [@Marian\_M](#):
>
> 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.?

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

---

<div class="post-metadata">

**Author:** ![Marian\_M](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@Marian\_M](http://forum.squareline.io/u/Marian_M)\
**Post date:** [April 17, 2023, 1:25pm UTC](http://forum.squareline.io/t/multiple-displays/1116/9 "2023-04-17T13:25:59Z")

</div>

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.?

---

<div class="post-metadata">

**Author:** ![Marian\_M](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/4af34b/32.png) [@Marian\_M](http://forum.squareline.io/u/Marian_M)\
**Post date:** [April 19, 2023, 6:49am UTC](http://forum.squareline.io/t/multiple-displays/1116/10 "2023-04-19T06:49:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Deadeye](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@Deadeye](http://forum.squareline.io/u/Deadeye)\
**Post date:** [April 22, 2023, 9:41am UTC](http://forum.squareline.io/t/multiple-displays/1116/11 "2023-04-22T09:41:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Deadeye](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@Deadeye](http://forum.squareline.io/u/Deadeye)\
**Post date:** [April 22, 2023, 1:16pm UTC](http://forum.squareline.io/t/multiple-displays/1116/12 "2023-04-22T13:16:55Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [April 23, 2023, 5:51pm UTC](http://forum.squareline.io/t/multiple-displays/1116/13 "2023-04-23T17:51:34Z")

</div>

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:

```c
    lv_disp_t * dispp = lv_disp_get_default();
    lv_theme_t * theme = lv_theme_XXXXX_init(dispp);
    lv_disp_set_theme(dispp, theme);
    ui_screen_XXXXXX_init();
    ui ____ initial_actions0 = lv_obj_create(NULL);
    lv_disp_load_scr(ui_screen);

```

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()`:

```c
lv_disp_set_default(disp_1);
ui_1_init();

lv_disp_set_default(disp_2);
ui_2_init();

```

---

<div class="post-metadata">

**Author:** ![Manel](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Manel](http://forum.squareline.io/u/Manel)\
**Post date:** [January 20, 2025, 11:00am UTC](http://forum.squareline.io/t/multiple-displays/1116/14 "2025-01-20T11:00:45Z")

</div>

Is multi-screen development available yet?

---

<div class="post-metadata">

**Author:** ![SquareLine\_Support](http://forum.squareline.io/user_avatar/forum.squareline.io/squareline_support/32/47_2.png) [@SquareLine\_Support](http://forum.squareline.io/u/SquareLine_Support)\
**Post date:** [January 22, 2025, 4:38pm UTC](http://forum.squareline.io/t/multiple-displays/1116/15 "2025-01-22T16:38:57Z")

</div>

## The SquareLin Studio officially doesn’t support multiple displays within one project, but here are some suggestions you can try

If your displays are **the same size** , follow these steps:

1. **SLS Project:**

2. **Initialize Displays in Code:**

3. **Load Screens to Displays:**

4. **Avoid Theme Conflicts:**

5. **Hardware Setup:**

**Key Notes:**

- Always **switch the default display** (`lv_disp_set_default()`) before interacting with a screen.
- Use **unique resource names** (fonts/images) to avoid conflicts.

---

<div class="post-metadata">

**Author:** ![Manel](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@Manel](http://forum.squareline.io/u/Manel)\
**Post date:** [April 30, 2025, 12:15pm UTC](http://forum.squareline.io/t/multiple-displays/1116/17 "2025-04-30T12:15:49Z")

</div>

Is there any example I can look at?
