lvgl: Physical display resolution doesn't work

Perform all steps below and tick them with [x]

  • Read the FAQ
  • Check the related part of the Documentation
  • Update lvgl to the latest version
  • Reproduce the issue in a Simulator

Describe the bug

I tried to port demo/widgets to a development board that has a 320*240 LCD. It appears that the resolution is too small for the widgets:

image

According to the porting document,

physical_hor_res horizontal resolution of the full / physical display in pixels. Only set this when not using the full screen (defaults to -1 / same as hor_res). physical_ver_res vertical resolution of the full / physical display in pixels. Only set this when not using the full screen (defaults to -1 / same as ver_res).

I should be able to use the LCD to display part of a physical display, for example, the left corner of the demo, i.e.

image

by applying a bigger physical resolution:

    static lv_disp_drv_t disp_drv;                                              /*Descriptor of a display driver*/
    lv_disp_drv_init(&disp_drv);                                                /*Basic initialization*/

    /*Set up the functions to access to your display*/

    /*Set the resolution of the display*/
    disp_drv.hor_res = GLCD_WIDTH;
    disp_drv.ver_res = GLCD_HEIGHT;

//#if LV_USE_DEMO_WIDGETS
    disp_drv.physical_hor_res = 480;
    disp_drv.physical_ver_res = 320;
//#endif

    /*Used to copy the buffer's content to the display*/
    disp_drv.flush_cb = disp_flush;

    /*Set a display buffer*/
    disp_drv.draw_buf = &draw_buf_dsc_1;

    /*Required for Example 3)*/
    //disp_drv.full_refresh = 1

    /* Fill a memory array with a color if you have GPU.
     * Note that, in lv_conf.h you can enable GPUs that has built-in support in LVGL.
     * But if you have a different GPU you can use with this callback.*/
    //disp_drv.gpu_fill_cb = gpu_fill;

    /*Finally register the driver*/
    lv_disp_drv_register(&disp_drv);
}

But this doesn’t work. Do I miss anything? or is this a defect?

To Reproduce

Expected behavior

image

Actually got

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

All great then 🙂

BTW, I thought you will see a compiler error if lv_extra.c is missing.

Anyway, feel free to close this issue if you see no more problems.

BTW, I thought you will see a compiler error if lv_extra.c is missing

in lv_cmsis_pack.c, there is a weak function which helps people to customize LVGL and decouple LVGL from the content inside extras.

/* when people don't want to use src/extra */
__attribute__((weak))
void lv_extra_init(void)
{
}

Anyway, feel free to close this issue if you see no more problems. Sure, as #3056 is merged, there is no reason to keep this one.

Thank you for your support!!!