Lv_task in microseconds instead of milliseconds?


I’ve made a simple metronome with motor and sound. However, the metronome cannot be accurate if it can’t call a task in fraction of milliseconds.

The metronome is really close enough for my application, but I wonder if it was possible to call tasks in microseconds instead of milliseconds.

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

ESP32 on TTGO watch 2020

What LVGL version are you using?


What do you want to achieve?

Call tasks in microseconds, or get around the problem.

What have you tried so far?

Looking at how the library works.
I’ve compared my application’s sound vs a phone app.
*Google’s metronome is not accurate

Code to reproduce

void metronome_task( lv_task_t * task );
lv_task_t* _metronome_task ;

// put this in setup
_metronome_task = lv_task_create( metronome_task, 1000, LV_TASK_PRIO_HIGHEST, NULL );

// This is the task time interval calculation
float bpm = 180.0; //beats per minute
float ratio = bpm/60.0;
int newPeriod = int(1000.0/ratio);

_metronome_task->period = newPeriod;

// task function
void metronome_task( lv_task_t * task ){

Screenshot and/or video

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

Unfortunately, no, the minimum task timing is 1ms. If you need a higher frequency task, I would suggest calling it at the desired frequency in the function that calls lv_task_handler.