Screen issue when button pressed multiple times

Hi all,
I am using LVGL library for my application on nrf52840 controller where i have to create a brightness control screen.As per the requirement, i have created two buttons toe increase/decrease the brightness.
First thing i observed that button response is slow.When i press the button,it takes around 1-2 seconds to increase/decrease the brightness.Can someone guide how to improve the the response?
Second thing is when button is presses multiple times,the screen shifts to left/right side and white screen appears on the display.I have no clue why this is happening.Please suggest a solution for this as well.
Any help will be appreciated. @kisvegabor @embeddedt
I am attaching the video of the issue .(display issue.mp4 - Google Drive).


It seems you use disp_drv.full_refresh=1 buffering and loading a new screen really takes a lot of time. I can see it at the content is updated slowly from top to bottom. I’m not sure but it seems the interface on which you update the screen (SPI?) is the bottle neck. What is the resolution of the display and the speed of the the interface?

Regarding the screen shifting issue, please try calling lv_obj_invalidate(lv_scr_act()) after lv_timer_handler. It will update the screen at max speed. Do you see the issue in this case as well?

If so, maybe you are sending new data to display while the bus is still busy?

Hey @kisvegabor ,
thanks for the response.
I am using SPI interface for the display with 8 Mbps data rate.I checked the configuration and i am not using full refresh mode at all.
Display resolution is 240280 and buffer size used is 24050;

For the second problem,after using lv_obj_invalidate(lv_scr_act()); issue is still coming.

Please also copy your disp_flush_cb function.

Can it be a time response delay?

Please see flush callback

void ili9341_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)

if(area->x2 < 0 || area->y2 < 0 || area->x1 > (ILI9341_WIDTH - 1) || area->y1 > (ILI9341_HEIGHT - 1)) {

  •    lv_disp_flush_ready(drv);*
  •    return;*
  • }*

  • /* Truncate the area to the screen /

  • int32_t act_x1 = area->x1 < 0 ? 0 : area->x1;*

  • int32_t act_y1 = area->y1 < 0 ? 0 : area->y1;*

  • int32_t act_x2 = area->x2 > ILI9341_WIDTH - 1 ? ILI9341_WIDTH - 1 : area->x2;*

  • int32_t act_y2 = area->y2 > ILI9341_HEIGHT - 1 ? ILI9341_HEIGHT - 1 : area->y2;*

  • int32_t y;*

  • uint8_t data[4];*

  • int32_t len = (act_x2 - act_x1 + 1) * 2;*

  • lv_coord_t w = (area->x2 - area->x1) + 1;*

  • /* window horizontal /

  • ili9341_write(ILI9341_CMD_MODE, 0x2A);*

  • data[0] = (uint8_t)(act_x1 >> 8);*

  • data[1] = (uint8_t)act_x1;*

  • data[2] = (uint8_t)(act_x2 >> 8);*

  • data[3] = (uint8_t)act_x2;*

  • ili9341_write_array(ILI9341_DATA_MODE, data, 4);*

  • /* window vertical /

  • ili9341_write(ILI9341_CMD_MODE, 0x2B);*

  • data[0] = (uint8_t)(act_y1 >> 8);*

  • data[1] = (uint8_t)act_y1;*

  • data[2] = (uint8_t)(act_y2 >> 8);*

  • data[3] = (uint8_t)act_y2;*

  • ili9341_write_array(ILI9341_DATA_MODE, data, 4);*

  • ili9341_write(ILI9341_CMD_MODE, 0x2C);*

  • for(y = act_y1; y <= act_y2; y++) {*

  •    ili9341_write_array(ILI9341_DATA_MODE, (uint8_t *)color_p, len);*
  •    color_p += w;*
  • }*

  • lv_disp_flush_ready(drv);*

@kisvegabor any update on this?


The flush_cb looks correct but I have no idea why you see the original issue. :frowning:

turn off the scrolling for the base object. The object at the bottom or what is called the “screen” is either made by you and set using the function lv_disp_load_scr or gotten using lv_scr_act. The latter is typically used in combination with lv_*_create functions an example is lv_obj_create(lv_scr_act()). If that is what is being done then you need to separate the lv_scr_act call so you can modify the returned object from it.

The reason why you are having such horrible lag with the button presses is because of what we call fat fingers on really tiny displays. Small displays like that should really be used with a resistive display and a stylus or the buttons need to be made larger. The scrolling being turned on is also giving you a hard hour with it as well when it is coupled with the really low SPI speed. The processor speed might also been an issue depending on what it is.

You should be able to manage the problem by making the buttons a little bit larger and turning off the scrolling. I think with those 2 things being done you will find that it will respond better.