Lv_port_esp32 and screen during update switches between two buffers?

Used Version: current version of lv_port_esp32 using the display drivers for ILI9341 and the monochrome driver for SSD1306 and SH1107.

I’m going to update a label regularly. When doing this, on the monochrome displays (using the drvier for SSD1306 and SH1107 I uploaded) I’ve a odd result. When using the ILI9341 everything is fine.

The label with an increasing numer is shown correctly, but in every second refresh content from the very first initialization is shown.

I expect to see “Hello!” in the first line, and an increasing number in the bottom line. Later is increased and refreshed every second.
The results are shown in a sequence of 4 screenshots:

In the bottom line you can see the overlaying “empty” from the Initialization.

The code I’m using follows is an modified version of the monochrome and is available here, with the changes made in main.c:

label2 = lv_label_create(scr, NULL);

/Modify the Label’s text/
lv_label_set_text(label1, “Hello!”);
lv_label_set_text(label2, “empty”);

/* Align the Label to the center
* NULL means align on parent (which is the screen now)
* 0, 0 at the end means an x, y offset after alignment*/
lv_obj_align(label1, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
lv_obj_align(label2, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
display_done = true;
lv_task_create((lv_task_cb_t)display_update_func, 1000, LV_TASK_PRIO_LOW, NULL);

and

void display_update_func(void* p)
{
static int64_t ticker = 0;
lv_label_set_text_fmt(label2, “%ld”, ticker);
ticker++;
}

It looks like the buf1 and buf2 copying is not done correctly.

Do I use the functions corretly or do I have to take care on the buffer management or other preparation tasks?

Regards
Andreas

I added rounder and flush log entries, which seems to be ok:

I (1620) demo: display_update_func
I (1620) SH1107: sh1107_rounder > (42 45) -> (86 63), < (42 40) -> (86 63)
I (1620) SH1107: sh1107_rounder > (42 45) -> (86 63), < (42 40) -> (86 63)
I (1620) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (1640) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (1640) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (1660) SH1107: sh1107_flush (0 0) -> (127 63), row 0 -> 15
I (2620) demo: display_update_func
I (2620) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (2620) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (2650) SH1107: sh1107_flush (0 0) -> (127 63), row 0 -> 15
I (3630) demo: display_update_func
I (3630) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (3630) SH1107: sh1107_rounder > (42 45) -> (50 63), < (42 40) -> (50 63)
I (3650) SH1107: sh1107_flush (0 0) -> (127 63), row 0 -> 15

@Carlos_Diaz
Do you have any idea?

I made some progress in analyzing the problem.

If I use rounder() to always send the complete display (so whatever comes in I return 128x64 for landscape display), everything works fine. (I found an issue in my code for sh1107 that lv_disp_flush_ready is called to often, but the result is still ok -> PR will come soon).

If only a partial display is to be send, I think that my implementation for sh1107 and ssd1306 is not correct. I copy from the full-sized buffer (lv_color_t * color_p) given to the flush function the respective parts and send it to the display. But, if I read the e.g. ILI9341 implementation the buffer is organized as follows:

  • for the area given (const lv_area_t * area)
  • and the given buffer (lv_color_t * color_p)
  • start with top left corner, and send a horizontal line of color_p data and of size area->x2 - area->x1
  • repeat for the next line for area->y2- area->y1 lines

So, for the rectangle area line by line is to be send to the display, beginning with color_p.

Is that correct?

I’ll then update the code and send a PR soon. Currently I’m pretty busy with my day work…
(maybe it would be good to spend a few lines in the LittlevGL Documentation, p.10.)

Regards
Andreas

Hi @kisvegabor and @an-erd,

Sorry for the very late reply, I’m also kind of busy with may day work and haven’t been able to play with the lv_port_esp32 repo.

I haven’t tested the SSD1306 driver thoroughly, did some toy projects with it and everything seem to work fine. Indeed, the ILI9341 flush function update only a part of the display when LVGL tell it to.

If possible send the PR with “atomic” commits, so we can merge them into the master branch and also into the dev-7.0 branch. Let me know if you need any help with that.

Regards
Carlos

1 Like