From 39d9fc20530978743d6134f60a85785907323c19 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 17 Jan 2021 18:25:22 +0100 Subject: Fix bug in animation management for lv_label --- ..._bug_in_animation_management_for_lv_label.patch | 51 ++++++++++++++++++++++ src/libs/lvgl/src/lv_misc/lv_anim.c | 4 +- src/libs/lvgl/src/lv_misc/lv_anim.h | 6 +-- 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch (limited to 'src/libs') diff --git a/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch b/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch new file mode 100644 index 00000000..7b4c204a --- /dev/null +++ b/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch @@ -0,0 +1,51 @@ +Index: src/libs/lvgl/src/lv_misc/lv_anim.c +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.c b/src/libs/lvgl/src/lv_misc/lv_anim.c +--- a/src/libs/lvgl/src/lv_misc/lv_anim.c (revision 12a3b6cc8ec1fd6b951c353ab3a5fbbb9934fdd4) ++++ b/src/libs/lvgl/src/lv_misc/lv_anim.c (date 1610901672072) +@@ -158,12 +158,12 @@ + * @param end end value of the animation + * @return the required time [ms] for the animation with the given parameters + */ +-uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) ++uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) + { + int32_t d = LV_MATH_ABS((int32_t)start - end); + uint32_t time = (int32_t)((int32_t)(d * 1000) / speed); + +- if(time > UINT16_MAX) time = UINT16_MAX; ++ if(time > UINT32_MAX) time = UINT32_MAX; + + if(time == 0) { + time++; +Index: src/libs/lvgl/src/lv_misc/lv_anim.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.h b/src/libs/lvgl/src/lv_misc/lv_anim.h +--- a/src/libs/lvgl/src/lv_misc/lv_anim.h (revision 12a3b6cc8ec1fd6b951c353ab3a5fbbb9934fdd4) ++++ b/src/libs/lvgl/src/lv_misc/lv_anim.h (date 1610901672076) +@@ -73,8 +73,8 @@ + lv_anim_ready_cb_t ready_cb; /**< Call it when the animation is ready*/ + int32_t start; /**< Start value*/ + int32_t end; /**< End value*/ +- uint16_t time; /**< Animation time in ms*/ +- int16_t act_time; /**< Current time in animation. Set to negative to make delay.*/ ++ uint32_t time; /**< Animation time in ms*/ ++ int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/ + uint16_t playback_pause; /**< Wait before play back*/ + uint16_t repeat_pause; /**< Wait before repeat*/ + #if LV_USE_USER_DATA +@@ -266,7 +266,7 @@ + * @param end end value of the animation + * @return the required time [ms] for the animation with the given parameters + */ +-uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); ++uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); + + /** + * Calculate the current value of an animation applying linear characteristic diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.c b/src/libs/lvgl/src/lv_misc/lv_anim.c index 790dfc77..77bd87b9 100644 --- a/src/libs/lvgl/src/lv_misc/lv_anim.c +++ b/src/libs/lvgl/src/lv_misc/lv_anim.c @@ -158,12 +158,12 @@ uint16_t lv_anim_count_running(void) * @param end end value of the animation * @return the required time [ms] for the animation with the given parameters */ -uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) +uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) { int32_t d = LV_MATH_ABS((int32_t)start - end); uint32_t time = (int32_t)((int32_t)(d * 1000) / speed); - if(time > UINT16_MAX) time = UINT16_MAX; + if(time > UINT32_MAX) time = UINT32_MAX; if(time == 0) { time++; diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.h b/src/libs/lvgl/src/lv_misc/lv_anim.h index 36cc35ad..b43035aa 100644 --- a/src/libs/lvgl/src/lv_misc/lv_anim.h +++ b/src/libs/lvgl/src/lv_misc/lv_anim.h @@ -73,8 +73,8 @@ typedef struct _lv_anim_t lv_anim_ready_cb_t ready_cb; /**< Call it when the animation is ready*/ int32_t start; /**< Start value*/ int32_t end; /**< End value*/ - uint16_t time; /**< Animation time in ms*/ - int16_t act_time; /**< Current time in animation. Set to negative to make delay.*/ + uint32_t time; /**< Animation time in ms*/ + int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/ uint16_t playback_pause; /**< Wait before play back*/ uint16_t repeat_pause; /**< Wait before repeat*/ #if LV_USE_USER_DATA @@ -266,7 +266,7 @@ uint16_t lv_anim_count_running(void); * @param end end value of the animation * @return the required time [ms] for the animation with the given parameters */ -uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); +uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); /** * Calculate the current value of an animation applying linear characteristic -- cgit v1.2.3