From 51046911e48baf64015624541d905ce0ba37ad41 Mon Sep 17 00:00:00 2001 From: qingliyu <45723140+qingliyu@users.noreply.github.com> Date: Thu, 1 Dec 2022 18:33:37 +0800 Subject: [PATCH] fix(gif): stop the timer on looping end to avoid high CPU usage (#3841) fixes #3812 --- src/libs/gif/lv_gif.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/gif/lv_gif.c b/src/libs/gif/lv_gif.c index c89fb895c..51b152440 100644 --- a/src/libs/gif/lv_gif.c +++ b/src/libs/gif/lv_gif.c @@ -99,6 +99,8 @@ void lv_gif_restart(lv_obj_t * obj) { lv_gif_t * gifobj = (lv_gif_t *) obj; gd_rewind(gifobj->gif); + lv_timer_resume(gifobj->timer); + lv_timer_reset(gifobj->timer); } /********************** @@ -138,6 +140,7 @@ static void next_frame_task_cb(lv_timer_t * t) /*It was the last repeat*/ if(gifobj->gif->loop_count <= 1) { lv_res_t res = lv_event_send(obj, LV_EVENT_READY, NULL); + lv_timer_pause(t); if(res != LV_FS_RES_OK) return; } else {