diff --git a/lv_conf_templ.h b/lv_conf_templ.h index c1bd91c54..aef7a6104 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -60,12 +60,16 @@ #define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ /*Color settings*/ -#define LV_COLOR_DEPTH 24 -#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn*/ +#define LV_COLOR_DEPTH 16 +#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn*/ /*Text settings*/ #define LV_TXT_UTF8 1 -#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/ + +/*Feature usage*/ +#define LV_NO_ANIM 0 /*1: disable all animations*/ +#define LV_NO_SHADOW 0 /*1: disable shadows*/ /*================== * THEME USAGE diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 3db2c601d..3b857f2ff 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -45,11 +45,12 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); +#if LV_NO_SHADOW == 0 static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, const lv_opa_t * map); - +#endif static uint16_t lv_draw_cont_radius_corr(uint16_t r, lv_coord_t w, lv_coord_t h); @@ -69,8 +70,10 @@ static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx; static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill; static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter; +#if USE_LV_IMG static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv_color_t * map_p, lv_opa_t opa, bool transp, bool upscale, lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap; #endif +#endif /********************** @@ -91,10 +94,11 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_sty { if(area_get_height(coords) < 1 || area_get_width(coords) < 1) return; +#if LV_NO_SHADOW == 0 if(style->body.shadow.width != 0) { lv_draw_rect_shadow(coords, mask, style); } - +#endif if(style->body.empty == 0){ lv_draw_rect_main_mid(coords, mask, style); @@ -339,6 +343,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty } } +#if USE_LV_IMG /** * Draw an image * @param coords the coordinates of the image @@ -440,6 +445,8 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, } } } +#endif + /** * Draw a line @@ -1123,6 +1130,8 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t } } +#if LV_NO_SHADOW == 0 + /** * Draw a shadow * @param rect pointer to rectangle object @@ -1422,6 +1431,9 @@ static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv } } + +#endif + static uint16_t lv_draw_cont_radius_corr(uint16_t r, lv_coord_t w, lv_coord_t h) { if(r >= (w >> 1)){ diff --git a/lv_draw/lv_draw.h b/lv_draw/lv_draw.h index 6f7d886b8..9e45b5812 100644 --- a/lv_draw/lv_draw.h +++ b/lv_draw/lv_draw.h @@ -72,6 +72,7 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask_p, lv_co void lv_draw_label(const lv_area_t * cords_p,const lv_area_t * mask_p, const lv_style_t * style_p, const char * txt, lv_txt_flag_t flag, lv_point_t * offset); +#if USE_LV_IMG /** * Draw an image * @param cords_p the coordinates of the image @@ -80,6 +81,7 @@ void lv_draw_label(const lv_area_t * cords_p,const lv_area_t * mask_p, const lv_ */ void lv_draw_img(const lv_area_t * cords_p, const lv_area_t * mask_p, const lv_style_t * style_p, const char * fn); +#endif /** * Draw a line diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index 09b3bf68b..0e2b470a2 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -6,12 +6,13 @@ /********************* * INCLUDES *********************/ -#include "../../lv_conf.h" +#include "lv_anim.h" + +#if LV_NO_ANIM == 0 #include #include #include "../lv_hal/lv_hal_tick.h" #include "lv_task.h" -#include "lv_anim.h" #include "lv_math.h" /********************* @@ -261,3 +262,4 @@ static bool anim_ready_handler(lv_anim_t * a) return invalid; } +#endif diff --git a/lv_misc/lv_anim.h b/lv_misc/lv_anim.h index 934f0e5ad..1d42305ba 100644 --- a/lv_misc/lv_anim.h +++ b/lv_misc/lv_anim.h @@ -14,6 +14,9 @@ extern "C" { /********************* * INCLUDES *********************/ +#include "../../../lv_conf.h" +#if LV_NO_ANIM == 0 + #include #include @@ -113,8 +116,11 @@ lv_anim_path_t * lv_anim_get_path(lv_anim_path_name_t name); * MACROS **********************/ +#endif /*LV_NO_ANIM == 0*/ + #ifdef __cplusplus } /* extern "C" */ #endif -#endif +#endif /*LV_ANIM_H*/ + diff --git a/lv_obj/lv_indev.c b/lv_obj/lv_indev.c index a251f5858..b551700bd 100644 --- a/lv_obj/lv_indev.c +++ b/lv_obj/lv_indev.c @@ -239,6 +239,7 @@ static void indev_proc_task(void * param) indev_proc_point(&i->state); } else if (i->driver.type == LV_INDEV_TYPE_KEYPAD) { +#if LV_OBJ_GROUP != 0 if(i->group != NULL && data.state == LV_INDEV_EVENT_PR && data.key != 0) { if(data.key == LV_GROUP_KEY_NEXT) { lv_group_focus_next(i->group); @@ -250,6 +251,7 @@ static void indev_proc_task(void * param) lv_group_send_data(i->group, data.key); } } +#endif } } diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 2094e5d0f..a7b979ba9 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -67,8 +67,9 @@ void lv_init(void) lv_fs_init(); lv_ufs_init(); lv_font_init(); +#if LV_NO_ANIM == 0 lv_anim_init(); - +#endif /*Clear the screen*/ lv_area_t scr_area; lv_area_set(&scr_area, 0, 0, LV_HOR_RES, LV_VER_RES); @@ -279,10 +280,10 @@ lv_res_t lv_obj_del(lv_obj_t * obj) /*Set i to the next node*/ i = i_next; } - +#if LV_NO_ANIM == 0 /*Remove the animations from this object*/ lv_anim_del(obj, NULL); - +#endif /*Remove the object from parent's children list*/ lv_obj_t * par = lv_obj_get_parent(obj); if(par == NULL) { /*It is a screen*/ @@ -909,6 +910,7 @@ void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p) } #endif +#if LV_NO_ANIM == 0 /** * Animate an object * @param obj pointer to an object to animate @@ -986,6 +988,9 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1 lv_anim_create(&a); } + +#endif + /*======================= * Getter functions *======================*/ @@ -1529,7 +1534,9 @@ static void delete_children(lv_obj_t * obj) } /*Remove the animations from this object*/ +#if LV_NO_ANIM == 0 lv_anim_del(obj, NULL); +#endif /*Delete from the group*/ #if LV_OBJ_GROUP != 0 diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index b58f28dc3..f560b3900 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -530,6 +530,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_num); void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p); #endif +#if LV_NO_ANIM == 0 /** * Animate an object * @param obj pointer to an object to animate @@ -539,6 +540,7 @@ void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p); * @param cb a function to call when the animation is ready */ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void (*cb) (lv_obj_t *)); +#endif /*======================= * Getter functions diff --git a/lv_obj/lv_style.c b/lv_obj/lv_style.c index 0e67e902b..2c867e517 100644 --- a/lv_obj/lv_style.c +++ b/lv_obj/lv_style.c @@ -14,25 +14,31 @@ /********************* * DEFINES *********************/ +#if LV_NO_ANIM == 0 #define LV_STYLE_ANIM_RES 256 /*Animation max in 1024 steps*/ #define LV_STYLE_ANIM_SHIFT 8 /*log2(LV_STYLE_ANIM_RES)*/ #define VAL_PROP(v1, v2, r) v1 + (((v2-v1) * r) >> LV_STYLE_ANIM_SHIFT) #define STYLE_ATTR_ANIM(attr, r) if(start->attr != end->attr) act->attr = VAL_PROP(start->attr, end->attr, r) +#endif /********************** * TYPEDEFS **********************/ +#if LV_NO_ANIM == 0 typedef struct { lv_style_t style_start; /*Save not only pointers because if same as 'style_anim' then it will be modified too*/ lv_style_t style_end; lv_style_t * style_anim; }lv_style_anim_dsc_t; +#endif /********************** * STATIC PROTOTYPES **********************/ +#if LV_NO_ANIM == 0 static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val); +#endif /********************** * STATIC VARIABLES @@ -208,8 +214,7 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src) memcpy(dest, src, sizeof(lv_style_t)); } - - +#if LV_NO_ANIM == 0 /** * Create an animation from a pre-configured 'lv_style_anim_t' variable * @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied) @@ -238,11 +243,11 @@ void lv_style_anim_create(lv_style_anim_t * anim) lv_anim_create(&a); } - +#endif /********************** * STATIC FUNCTIONS **********************/ - +#if LV_NO_ANIM == 0 /** * Used by the style animations to set the values of a style according to start and end style. * @param dsc the 'animated variable' set by lv_style_anim_create() @@ -295,3 +300,4 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val) lv_mem_free(dsc); } } +#endif diff --git a/lv_obj/lv_style.h b/lv_obj/lv_style.h index 5ab4a5e9f..5c9806d06 100644 --- a/lv_obj/lv_style.h +++ b/lv_obj/lv_style.h @@ -101,6 +101,7 @@ typedef struct }line; }lv_style_t; +#if LV_NO_ANIM == 0 typedef struct { const lv_style_t * style_start; /*Pointer to the starting style*/ const lv_style_t * style_end; /*Pointer to the destination style*/ @@ -128,6 +129,7 @@ a.repeat_pause = 0; a.end_cb = NULL; lv_style_anim_create(&a); */ +#endif /********************** * GLOBAL PROTOTYPES @@ -145,11 +147,13 @@ void lv_style_init (void); */ void lv_style_copy(lv_style_t * dest, const lv_style_t * src); +#if LV_NO_ANIM == 0 /** * Create an animation from a pre-configured 'lv_style_anim_t' variable * @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied) */ void lv_style_anim_create(lv_style_anim_t * anim); +#endif /************************* * GLOBAL VARIABLES diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 50b94c192..900a72210 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -115,6 +115,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value) lv_obj_invalidate(bar); } +#if LV_USE_ANIM /** * Set a new value with animation on the bar * @param bar pointer to a bar object @@ -144,8 +145,8 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time) a.repeat_pause = 0; lv_anim_create(&a); - } +#endif /** diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 93545aff3..8fb781c58 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -21,7 +21,15 @@ /********************* * DEFINES *********************/ -#define LV_DDLIST_DEF_ANIM_TIME 200 /*ms*/ + +#if LV_NO_ANIM == 0 +# ifndef LV_DDLIST_DEF_ANIM_TIME +# define LV_DDLIST_DEF_ANIM_TIME 200 /*ms*/ +# endif +#else +# undef LV_DDLIST_DEF_ANIM_TIME +# define LV_DDLIST_DEF_ANIM_TIME 0 /*No animation*/ +#endif /********************** * TYPEDEFS @@ -592,6 +600,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time) lv_obj_set_height(ddlist, new_height); lv_ddlist_pos_current_option(ddlist); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = ddlist; a.start = lv_obj_get_height(ddlist); @@ -607,6 +616,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time) a.repeat_pause = 0; lv_anim_create(&a); +#endif } } diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 262b6deaf..b17510b2c 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -39,9 +39,11 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode); static void lv_label_refr_text(lv_obj_t * label); static void lv_label_revert_dots(lv_obj_t *label); + +#if LV_NO_ANIM == 0 static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x); static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y); - +#endif /********************** * STATIC VARIABLES **********************/ @@ -221,11 +223,13 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); +#if LV_NO_ANIM == 0 /*Delete the old animation (if exists)*/ lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_x); lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_y); lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_x); lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_y); +#endif ext->offset.x = 0; ext->offset.y = 0; @@ -726,6 +730,7 @@ static void lv_label_refr_text(lv_obj_t * label) /*Start scrolling if the label is greater then its parent*/ if(ext->long_mode == LV_LABEL_LONG_SCROLL) { +#if LV_NO_ANIM == 0 lv_obj_t * parent = lv_obj_get_parent(label); /*Delete the potential previous scroller animations*/ @@ -756,10 +761,12 @@ static void lv_label_refr_text(lv_obj_t * label) anim.time = lv_anim_speed_to_time(ext->anim_speed, anim.start, anim.end); lv_anim_create(&anim); } +#endif } } /*In roll mode keep the size but start offset animations*/ else if(ext->long_mode == LV_LABEL_LONG_ROLL) { +#if LV_NO_ANIM == 0 lv_anim_t anim; anim.var = label; anim.repeat = 1; @@ -794,6 +801,7 @@ static void lv_label_refr_text(lv_obj_t * label) lv_anim_del(label, (lv_anim_fp_t) lv_label_set_offset_y); ext->offset.y = 0; } +#endif } else if(ext->long_mode == LV_LABEL_LONG_DOT) { if(size.y <= lv_obj_get_height(label)) { /*No dots are required, the text is short enough*/ @@ -879,6 +887,7 @@ static void lv_label_revert_dots(lv_obj_t *label) ext->dot_end = LV_LABEL_DOT_END_INV; } +#if LV_NO_ANIM == 0 static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); @@ -893,3 +902,4 @@ static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y) lv_obj_invalidate(label); } #endif +#endif diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index ea6d404e8..04f92d99c 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -19,8 +19,14 @@ * DEFINES *********************/ #define LV_LIST_LAYOUT_DEF LV_LAYOUT_COL_M -#ifndef LV_LIST_FOCUS_TIME -#define LV_LIST_FOCUS_TIME 100 /*Animation time of focusing to the a list element [ms] (0: no animation) */ + +#if LV_NO_ANIM == 0 +# ifndef LV_LIST_FOCUS_TIME +# define LV_LIST_FOCUS_TIME 100 /*Animation time of focusing to the a list element [ms] (0: no animation) */ +# endif +#else +# undef LV_LIST_FOCUS_TIME +# define LV_LIST_FOCUS_TIME 0 /*No animations*/ #endif /********************** @@ -372,6 +378,7 @@ void lv_list_up(lv_obj_t * list) if(ext->anim_time == 0) { lv_obj_set_y(scrl, new_y); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = scrl; a.start = lv_obj_get_y(scrl); @@ -386,6 +393,7 @@ void lv_list_up(lv_obj_t * list) a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); +#endif } } break; @@ -413,6 +421,7 @@ void lv_list_down(lv_obj_t * list) if(ext->anim_time == 0) { lv_obj_set_y(scrl, new_y); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = scrl; a.start = lv_obj_get_y(scrl); @@ -427,6 +436,8 @@ void lv_list_down(lv_obj_t * list) a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); + +#endif } break; } diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index 8080c75db..ad39d8ec1 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -19,7 +19,15 @@ /********************* * DEFINES *********************/ -#define LV_MBOX_CLOSE_ANIM_TIME 200 /*Default close anim. time [ms]*/ + +#if LV_NO_ANIM == 0 +# ifndef LV_MBOX_CLOSE_ANIM_TIME +# define LV_MBOX_CLOSE_ANIM_TIME 200 /*List close animation time) */ +# endif +#else +# undef LV_MBOX_CLOSE_ANIM_TIME +# define LV_MBOX_CLOSE_ANIM_TIME 0 /*No animations*/ +#endif /********************** * TYPEDEFS @@ -192,6 +200,7 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) { lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); +#if LV_NO_ANIM == 0 if(ext->anim_time != 0) { /*Add shrinking animations*/ lv_obj_animate(mbox, LV_ANIM_GROW_H| ANIM_OUT, ext->anim_time, delay, NULL); @@ -202,6 +211,9 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) } else { lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, (void (*)(lv_obj_t*))lv_obj_del); } +#else + lv_obj_del(mbox); +#endif } /** @@ -210,7 +222,9 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) */ void lv_mbox_stop_auto_close(lv_obj_t * mbox) { +#if LV_NO_ANIM == 0 lv_anim_del(mbox, NULL); +#endif } /** diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 419b7b95e..5d071122e 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -307,6 +307,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time) lv_obj_set_y(ext->scrl, scrlable_y); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.act_time = 0; a.start = lv_obj_get_y(ext->scrl); @@ -319,6 +320,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time) a.path = lv_anim_get_path(LV_ANIM_PATH_LIN); a.fp = (lv_anim_fp_t) lv_obj_set_y; lv_anim_create(&a); +#endif } } diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 68e70bf67..d24d8aa92 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -427,6 +427,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en) if(ext->ddlist.anim_time == 0 || anim_en == false) { lv_obj_set_y(roller_scrl, new_y); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = roller_scrl; a.start = lv_obj_get_y(roller_scrl); @@ -441,6 +442,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en) a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); +#endif } } diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 31e78442e..2770a6fd1 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -137,7 +137,8 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_ta); } - + +#if LV_NO_ANIM == 0 /*Create a cursor blinker animation*/ lv_anim_t a; a.var = new_ta; @@ -153,6 +154,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) a.playback_pause = 0; a.path = lv_anim_get_path(LV_ANIM_PATH_STEP); lv_anim_create(&a); +#endif return new_ta; } @@ -183,6 +185,8 @@ void lv_ta_add_char(lv_obj_t * ta, char c) lv_mem_assert(ext->pwd_tmp); lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, letter_buf); +#if LV_NO_ANIM == 0 + /*Auto hide characters*/ lv_anim_t a; a.var = ta; a.fp = (lv_anim_fp_t)pwd_char_hider_anim; @@ -197,6 +201,7 @@ void lv_ta_add_char(lv_obj_t * ta, char c) a.playback_pause = 0; a.path = lv_anim_get_path(LV_ANIM_PATH_STEP); lv_anim_create(&a); +#endif } /*Move the cursor after the new character*/ @@ -223,6 +228,8 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt) lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, txt); +#if LV_NO_ANIM == 0 + /*Auto hide characters*/ lv_anim_t a; a.var = ta; a.fp = (lv_anim_fp_t)pwd_char_hider_anim; @@ -237,6 +244,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt) a.playback_pause = 0; a.path = lv_anim_get_path(LV_ANIM_PATH_STEP); lv_anim_create(&a); +#endif } /*Move the cursor after the new text*/ @@ -306,6 +314,8 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(txt) + 1); strcpy(ext->pwd_tmp, txt); +#if LV_NO_ANIM == 0 + /*Auto hide characters*/ lv_anim_t a; a.var = ta; a.fp = (lv_anim_fp_t)pwd_char_hider_anim; @@ -320,6 +330,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) a.playback_pause = 0; a.path = lv_anim_get_path(LV_ANIM_PATH_STEP); lv_anim_create(&a); +#endif } } @@ -376,6 +387,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) ext->cursor.valid_x = cur_pos.x; +#if LV_NO_ANIM == 0 /*Reset cursor blink animation*/ lv_anim_t a; a.var = ta; @@ -391,6 +403,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) a.playback_pause = 0; a.path = lv_anim_get_path(LV_ANIM_PATH_STEP); lv_anim_create(&a); +#endif lv_obj_invalidate(ta); } diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 70b110d88..9c920e1dd 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -17,6 +17,14 @@ /********************* * DEFINES *********************/ +#if LV_NO_ANIM == 0 +# ifndef LV_TABVIEW_ANIM_TIME +# define LV_TABVIEW_ANIM_TIME 100 /*Animation time of focusing to the a list element [ms] (0: no animation) */ +# endif +#else +# undef LV_TABVIEW_ANIM_TIME +# define LV_TABVIEW_ANIM_TIME 0 /*No animations*/ +#endif /********************** * TYPEDEFS @@ -240,6 +248,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) if(ext->anim_time == 0 || anim_en == false) { lv_obj_set_x(ext->content, cont_x); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = ext->content; a.start = lv_obj_get_x(ext->content); @@ -254,6 +263,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); +#endif } /*Move the indicator*/ @@ -264,6 +274,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) if(ext->anim_time == 0 || anim_en == false ) { lv_obj_set_x(ext->indic, indic_x); } else { +#if LV_NO_ANIM == 0 lv_anim_t a; a.var = ext->indic; a.start = lv_obj_get_x(ext->indic); @@ -278,6 +289,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) a.repeat = 0; a.repeat_pause = 0; lv_anim_create(&a); +#endif } lv_btnm_set_toggle(ext->btns, true, ext->tab_cur);