Add a counter for the task

As far as I know, the current task has a single execution function void lv_task_once(lv_task_t * task);.

/**
 * Descriptor of a lv_task
 */
typedef struct _lv_task_t
{
    uint32_t period; /**< How often the task should run */
    uint32_t last_run; /**< Last time the task ran */
    lv_task_cb_t task_cb; /**< Task function */

    void * user_data; /**< Custom user data */

    uint8_t prio : 3; /**< Task priority */
    uint8_t once : 1; /**< 1: one shot task */
} lv_task_t;

/**
 * Delete the lv_task after one call
 * @param task pointer to a lv_task.
 */
void lv_task_once(lv_task_t * task);

But sometimes we need to control the times of tasks to be execute .
Maybe more than once.

Therefore, I think it can be simply modified to achieve the purpose.

/**
 * Descriptor of a lv_task
 */
typedef struct _lv_task_t
{
    uint32_t period; /**< How often the task should run */
    uint32_t last_run; /**< Last time the task ran */
    lv_task_cb_t task_cb; /**< Task function */

    void * user_data; /**< Custom user data */

    uint8_t prio : 3; /**< Task priority */
    //uint8_t once : 1; /**< 1: one shot task */
    int32_t time; /**< 1: Task times;  -1 : infinity;  0 : stop ;  n>0: residual times */
} lv_task_t;

Couldn’t you just enable and disable the task within your application? You could call lv_task_set_prio(task, LV_TASK_PRIO_OFF) after it’s been run several times. I think that would be simpler.