Trying to set a custom tick source

Description

How to set a custom tick source function

What MCU/Processor/Board and compiler are you using?

ESP32/VScode/PlatformIO

What LVGL version are you using?

7.10

What do you want to achieve?

I’d like to set a custom tick function but the define generated refers to a string, not to the function itself.

What have you tried so far?

I set the HAL values using menuconfig in lvlg component menu. Hal settings in sdkconfig are:

#
# HAL Settings
#
CONFIG_LV_TICK_CUSTOM=y
CONFIG_LV_TICK_CUSTOM_INCLUDE="esp_timer.h"
CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR="(long)esp_timer_get_time()/1000"
# end of HAL Settings

The generated line in sdkconfig.h is

#define CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR "(long)esp_timer_get_time()/1000"

Shouldn’t it be as follows?

#define CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR (long)esp_timer_get_time()/1000

The result is that the the function lv_tick_get() returns the pointer to the string of the define, not the result of the function. Am I doing something wrong in menuconfig?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Can you set the HAL setting to:

CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR=(long)esp_timer_get_time()/1000

I can’t have menuconfig setting the variable correctly, as it generates a string, not an expression (see my description). If I modify sdkconfig manually the expression is not recognized, and the variable CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR is set to millis().

1 Like

(cc @Carlos_Diaz)

Any changes? Problem is still exist in 8.1