Skip to content

Compilation failure and problems relating to missing lv_conf.h and library level lvgl.h #1

@vtjballeng

Description

@vtjballeng

This can be infuriatingly time consuming when you don't know what lvgl is ahead of time, that it's a library, where it's located, what do to with it, and where to copy it. Here is the location and where to put it:

cp /mnt/c/Users/username/Documents/Arduino/libraries/lvgl/lv_conf_template.h /mnt/c/Users/username/Documents/Arduino/libraries/lv_conf.h

Here are the other operations
I see - the notes indicate that you need to configure lv_conf.h with specific settings for this project. The file I deleted was meant to show the required configuration, not be included as a header. You need to:

  1. Install LVGL v8.3.11 in your Arduino libraries
  2. Configure the LVGL library's lv_conf.h file with these settings:
    - #define LV_COLOR_DEPTH 16
    - #define LV_COLOR_16_SWAP 1
    - #define LV_MEM_CUSTOM 1
    - #define LV_TICK_CUSTOM 1

The lv_conf.h file should be located in your Arduino libraries folder alongside the LVGL library. You typically need to:

  1. Copy lv_conf_template.h to lv_conf.h in the LVGL library folder
  2. Enable it by changing #if 0 to #if 1 at the top
  3. Set the four defines mentioned above

These settings are critical for:

  • 16-bit color depth with byte swapping for the display
  • Custom memory management using ESP32's PSRAM
  • Custom tick source for LVGL's timing

So this means that you're editing files at the library level that should likely be addressed at the repo level with specific overrides.

Also, it means that you're using an older LVGL version, 8.3.11 instead of the current 9.3.0 .

Change list:

  ⎿  Updated ../../Arduino/libraries/lv_conf.h with 4 additions and 4 removals
       12     */
       13
       14    /* clang-format off */
       15 -  #if 0 /*Set it to "1" to enable content*/
       15 +  #if 1 /*Set it to "1" to enable content*/
       16
       17    #ifndef LV_CONF_H
       18    #define LV_CONF_H
     ...
       27    #define LV_COLOR_DEPTH 16
       28
       29    /*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
       30 -  #define LV_COLOR_16_SWAP 0
       30 +  #define LV_COLOR_16_SWAP 1
       31
       32    /*Enable features to draw on transparent background.
       33     *It's required if opa, and transform_* style properties are used.
     ...
       46     *=========================*/
       47
       48    /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
       49 -  #define LV_MEM_CUSTOM 0
       49 +  #define LV_MEM_CUSTOM 1
       50    #if LV_MEM_CUSTOM == 0
       51        /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
       52        #define LV_MEM_SIZE (48U * 1024U)          /*[bytes]*/
     ...
       85
       86    /*Use a custom tick source that tells the elapsed time in milliseconds.
       87     *It removes the need to manually update the tick with `lv_tick_inc()`)*/
       88 -  #define LV_TICK_CUSTOM 0
       88 +  #define LV_TICK_CUSTOM 1
       89    #if LV_TICK_CUSTOM
       90        #define LV_TICK_CUSTOM_INCLUDE "Arduino.h"         /*Header for the system time function*/
       91        #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis())    /*Expression evaluating to current system time in ms*/

Also

#include "lvgl.h"
#include <lvgl.h>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions