diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index e1aa6cab0..0389daa3b 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -19,8 +19,6 @@ extern "C" { #include "../../../lv_conf.h" #endif -#if LV_USE_ANIMATION - #include #include #include @@ -33,6 +31,16 @@ extern "C" { * TYPEDEFS **********************/ +/*Can be used to indicate if animations are enabled or disabled in a case*/ +enum { + LV_ANIM_OFF, + LV_ANIM_ON, +}; + +typedef uint8_t lv_anim_enable_t; + +#if LV_USE_ANIMATION + struct _lv_anim_t; /* Generic prototype of "animator" functions. @@ -77,13 +85,6 @@ typedef struct _lv_anim_t uint32_t has_run : 1; /*Indicates the animation has run in this round*/ } lv_anim_t; -/*Can be used to indicate if animations are enabled or disabled in a case*/ -enum { - LV_ANIM_OFF, - LV_ANIM_ON, -}; - -typedef uint8_t lv_anim_enable_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/lv_objx/lv_bar.c b/src/lv_objx/lv_bar.c index 509988730..c91b8c342 100644 --- a/src/lv_objx/lv_bar.c +++ b/src/lv_objx/lv_bar.c @@ -220,11 +220,10 @@ void lv_bar_set_sym(lv_obj_t * bar, bool en) */ void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time) { -#if LV_USE_ANIMATION == 0 - anim_time = 0; -#endif +#if LV_USE_ANIMATION lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); ext->anim_time = anim_time; +#endif } /** diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index 4ce82491c..74d61463d 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -435,7 +435,7 @@ lv_label_align_t lv_ddlist_get_align(const lv_obj_t * ddlist) void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim) { #if LV_USE_ANIMATION == 0 - anim_en = false; + anim = false; #endif lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); ext->opened = 1; @@ -451,7 +451,7 @@ void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim) void lv_ddlist_close(lv_obj_t * ddlist, lv_anim_enable_t anim) { #if LV_USE_ANIMATION == 0 - anim_en = false; + anim = false; #endif lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); ext->opened = 0; @@ -811,7 +811,7 @@ static lv_res_t release_handler(lv_obj_t * ddlist) static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim) { #if LV_USE_ANIMATION == 0 - anim_en = false; + anim = false; #endif lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); const lv_style_t * style = lv_obj_get_style(ddlist); diff --git a/src/lv_objx/lv_ddlist.h b/src/lv_objx/lv_ddlist.h index 0fa0e30ff..ee6c1f70d 100644 --- a/src/lv_objx/lv_ddlist.h +++ b/src/lv_objx/lv_ddlist.h @@ -143,13 +143,6 @@ static inline void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time lv_page_set_anim_time(ddlist, anim_time); } -/** - * Set the open/close animation time. - * @param ddlist pointer to a drop down list - * @param anim_time: open/close animation time [ms] - */ -void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time); - /** * Set a style of a drop down list * @param ddlist pointer to a drop down list object @@ -230,13 +223,6 @@ static inline uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist) return lv_page_get_anim_time(ddlist); } -/** - * Get the open/close animation time. - * @param ddlist pointer to a drop down list - * @return open/close animation time [ms] - */ -uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist); - /** * Get a style of a drop down list * @param ddlist pointer to a drop down list object diff --git a/src/lv_objx/lv_list.c b/src/lv_objx/lv_list.c index 8237308e2..87febc4e7 100644 --- a/src/lv_objx/lv_list.c +++ b/src/lv_objx/lv_list.c @@ -657,7 +657,7 @@ void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim) { #if LV_USE_ANIMATION == 0 - anim_en = false; + anim = false; #endif lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn)); diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index 07e9daad7..f2839f502 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -218,9 +218,12 @@ void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode) */ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time) { - lv_page_ext_t * ext = lv_obj_get_ext_attr(page); #if LV_USE_ANIMATION + lv_page_ext_t * ext = lv_obj_get_ext_attr(page); ext->anim_time = anim_time; +#else + (void)page; /*Unused*/ + (void)anim_time; /*Unused*/ #endif } diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index 590928555..27f706914 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -365,8 +365,9 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) { lv_obj_set_x(ext->content, cont_x); - } else { + } #if LV_USE_ANIMATION + else { lv_anim_t a; a.var = ext->content; a.start = lv_obj_get_x(ext->content); @@ -381,8 +382,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); -#endif } +#endif /*Move the indicator*/ const lv_style_t * tabs_style = lv_obj_get_style(ext->btns); @@ -402,15 +403,19 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an break; } - if(anim == LV_ANIM_OFF || ext->anim_time == 0) { +#if LV_USE_ANIMATION + if(anim == LV_ANIM_OFF || ext->anim_time == 0) +#endif + { switch(ext->btns_pos) { case LV_TABVIEW_BTNS_POS_TOP: case LV_TABVIEW_BTNS_POS_BOTTOM: lv_obj_set_x(ext->indic, indic_pos); break; case LV_TABVIEW_BTNS_POS_LEFT: case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_y(ext->indic, indic_pos); break; } - } else { + } #if LV_USE_ANIMATION + else { lv_anim_t a; a.var = ext->indic; @@ -438,8 +443,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); -#endif } +#endif lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE); }