Merge pull request #171 from JF002/fix-lvgl-animation
Fix bug in animation management for lv_label
This commit is contained in:
commit
35d4f6d487
|
@ -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
|
|
@ -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++;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user