diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 0d710a1e1..6f1aac27b 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -90,6 +90,15 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) { if(group == NULL) return; + /*If the object is already in a group and focused then defocuse it*/ + if(obj->group_p) { + if(lv_obj_is_focused(obj)) { + lv_group_focus_next(obj->group_p); + + LV_LOG_INFO("group: assign object to an other group"); + } + } + obj->group_p = group; lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll); lv_mem_assert(next); diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index 3d7b97690..6027e20f9 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -254,9 +254,7 @@ static void indev_proc_task(void * param) (void)param; -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "indev_proc task started"); -#endif + LV_LOG_TRACE("indev task started"); lv_indev_data_t data; lv_indev_t * i; @@ -297,9 +295,7 @@ static void indev_proc_task(void * param) indev_act = NULL; /*End of indev processing, so no act indev*/ -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "indev_proc task finished"); -#endif + LV_LOG_TRACE("indev task finished"); } diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index a0a9e1d5a..99257e09a 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -62,9 +62,7 @@ static lv_ll_t scr_ll; /*Linked list of screens*/ */ void lv_init(void) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "lv_init called"); -#endif + LV_LOG_TRACE("lv_init started"); /*Initialize the lv_misc modules*/ lv_mem_init(); @@ -106,9 +104,8 @@ void lv_init(void) lv_indev_init(); #endif -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "lv_init ready"); -#endif + + LV_LOG_INFO("lv_init ready"); } /*-------------------- @@ -128,9 +125,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) lv_obj_t * new_obj = NULL; /*Create a screen if the parent is NULL*/ if(parent == NULL) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Screen create started"); -#endif + LV_LOG_TRACE("Screen create started"); new_obj = lv_ll_ins_head(&scr_ll); lv_mem_assert(new_obj); @@ -182,15 +177,12 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->ext_attr = NULL; -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Screen create ready"); -#endif + LV_LOG_INFO("Screen create ready"); } /*parent != NULL create normal obj. on a parent*/ else { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Object create started"); -#endif + LV_LOG_TRACE("Object create started"); + new_obj = lv_ll_ins_head(&(parent)->child_ll); lv_mem_assert(new_obj); if(new_obj == NULL) return NULL; @@ -273,9 +265,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy)); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Object create ready"); -#endif + LV_LOG_INFO("Object create ready"); } diff --git a/lv_core/lv_refr.c b/lv_core/lv_refr.c index 6ad8972c6..4f43e4251 100644 --- a/lv_core/lv_refr.c +++ b/lv_core/lv_refr.c @@ -167,9 +167,8 @@ void lv_refr_pop_from_buf(uint16_t num) static void lv_refr_task(void * param) { (void)param; -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "display refresh task started"); -#endif + + LV_LOG_TRACE("display refresh task started"); uint32_t start = lv_tick_get(); @@ -189,9 +188,8 @@ static void lv_refr_task(void * param) monitor_cb(lv_tick_elaps(start), px_num); } } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "display refresh task finished"); -#endif + + LV_LOG_TRACE("display refresh task finished"); } diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index ba75d4840..fa6390cac 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -217,13 +217,10 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p, }; if(font_p == NULL) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Font: character's bitmap not found"); -#endif + LV_LOG_WARN("Font: character's bitmap not found"); return; } - lv_coord_t pos_x = pos_p->x; lv_coord_t pos_y = pos_p->y; uint8_t letter_w = lv_font_get_real_width(font_p, letter); diff --git a/lv_hal/lv_hal_disp.c b/lv_hal/lv_hal_disp.c index 51341b139..cf4c55c17 100644 --- a/lv_hal/lv_hal_disp.c +++ b/lv_hal/lv_hal_disp.c @@ -150,19 +150,12 @@ void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * if(active == NULL) return; if(active->driver.disp_flush != NULL) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "Disp. flush called"); -#endif + LV_LOG_TRACE("disp flush started"); active->driver.disp_flush(x1, y1, x2, y2, color_p); + LV_LOG_TRACE("disp flush ready"); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Disp. flush ready"); -#endif } else { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Disp. flush: function not set"); -#endif + LV_LOG_WARN("disp flush function registered"); } } diff --git a/lv_hal/lv_hal_indev.c b/lv_hal/lv_hal_indev.c index ca8c8f8a4..eca2b615e 100644 --- a/lv_hal/lv_hal_indev.c +++ b/lv_hal/lv_hal_indev.c @@ -111,17 +111,12 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data) if(indev->driver.read) { data->user_data = indev->driver.user_data; -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "Indev read called"); -#endif + + LV_LOG_TRACE("idnev read started"); cont = indev->driver.read(data); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Indev read ready"); -#endif + LV_LOG_TRACE("idnev read finished"); } else { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Indev read: function not set"); -#endif + LV_LOG_WARN("indev function registered"); memset(data, 0, sizeof(lv_indev_data_t)); } diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index 01cf7d9b3..5e6a57639 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -62,7 +62,7 @@ void lv_anim_init(void) */ void lv_anim_create(lv_anim_t * anim_p) { - + LV_LOG_TRACE("animation create started") /* Do not let two animations for the same 'var' with the same 'fp'*/ if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/ @@ -82,10 +82,7 @@ void lv_anim_create(lv_anim_t * anim_p) * It's important if it happens in a ready callback. (see `anim_task`)*/ anim_list_changed = true; - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Animation created"); -#endif + LV_LOG_TRACE("animation created") } /** diff --git a/lv_misc/lv_font.c b/lv_misc/lv_font.c index 3a55f96ec..367c30f90 100644 --- a/lv_misc/lv_font.c +++ b/lv_misc/lv_font.c @@ -104,9 +104,6 @@ const uint8_t * lv_font_get_bitmap(const lv_font_t * font_p, uint32_t letter) font_i = font_i->next_page; } -#if USE_LV_LOG - if(letter >= ' ') lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Font: glyph not found"); -#endif return NULL; } @@ -132,9 +129,6 @@ uint8_t lv_font_get_width(const lv_font_t * font_p, uint32_t letter) font_i = font_i->next_page; } -#if USE_LV_LOG - if(letter >= ' ') lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Font: character's width not found"); -#endif return 0; } @@ -156,9 +150,6 @@ uint8_t lv_font_get_real_width(const lv_font_t * font_p, uint32_t letter) font_i = font_i->next_page; } -#if USE_LV_LOG - if(letter >= ' ') lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Font: character's width not found"); -#endif return 0; } @@ -178,9 +169,6 @@ uint8_t lv_font_get_bpp(const lv_font_t * font, uint32_t letter) font_i = font_i->next_page; } -#if USE_LV_LOG - if(letter >= ' ') lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Font: character's bpp not found"); -#endif return 0; } diff --git a/lv_misc/lv_log.h b/lv_misc/lv_log.h index 08b25fe33..2d3ec75f9 100644 --- a/lv_misc/lv_log.h +++ b/lv_misc/lv_log.h @@ -27,8 +27,7 @@ extern "C" { /*Possible log level. For compatibility declare it independently from `USE_LV_LOG`*/ typedef enum { - LV_LOG_LEVEL_DEBUG = 0, /*A lot of logs to show every detail*/ - LV_LOG_LEVEL_TRACE, /*Trace the most important calls*/ + LV_LOG_LEVEL_TRACE, /*A lot of logs to give detailed information*/ LV_LOG_LEVEL_INFO, /*Log important events*/ LV_LOG_LEVEL_WARN, /*Log if something unwanted happened but didn't caused problem*/ LV_LOG_LEVEL_ERROR, /*Only critical issue, when the system may fail*/ @@ -61,11 +60,19 @@ void lv_log_add(lv_log_level_t level, const char * file, uint32_t line, const ch * MACROS **********************/ +#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc); +#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc); +#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc); +#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc); + #else /*USE_LV_LOG*/ /*Do nothing if `USE_LV_LOG 0`*/ #define lv_log_add(level, file, line, dsc) {;} - +#define LV_LOG_TRACE(dsc) {;} +#define LV_LOG_INFO(dsc) {;} +#define LV_LOG_WARN(dsc) {;} +#define LV_LOG_ERROR(dsc) {;} #endif /*USE_LV_LOG*/ #ifdef __cplusplus diff --git a/lv_misc/lv_mem.c b/lv_misc/lv_mem.c index 45b6af434..4f9f15322 100644 --- a/lv_misc/lv_mem.c +++ b/lv_misc/lv_mem.c @@ -159,9 +159,8 @@ void * lv_mem_alloc(uint32_t size) } #endif -#if USE_LV_LOG - if(alloc == NULL) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Couldn't allocate memory"); -#endif + if(alloc == NULL) LV_LOG_WARN("Couldn't allocate memory"); + return alloc; } @@ -245,9 +244,8 @@ void * lv_mem_realloc(void * data_p, uint32_t new_size) } -#if USE_LV_LOG - if(new_p == NULL) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Couldn't allocate memory"); -#endif + if(new_p == NULL) LV_LOG_WARN("Couldn't allocate memory"); + return new_p; } diff --git a/lv_misc/lv_mem.h b/lv_misc/lv_mem.h index a4c3188ce..a179c78f0 100644 --- a/lv_misc/lv_mem.h +++ b/lv_misc/lv_mem.h @@ -106,7 +106,7 @@ uint32_t lv_mem_get_size(const void * data); #if USE_LV_LOG == 0 # define lv_mem_assert(p) {if(p == NULL) while(1); } #else -# define lv_mem_assert(p) {if(p == NULL) {lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, "Out of memory!"); while(1); }} +# define lv_mem_assert(p) {if(p == NULL) {LV_LOG_ERROR("Out of memory!"); while(1); }} #endif #ifdef __cplusplus } /* extern "C" */ diff --git a/lv_misc/lv_task.c b/lv_misc/lv_task.c index bfbc1a67e..886f28e5b 100644 --- a/lv_misc/lv_task.c +++ b/lv_misc/lv_task.c @@ -56,10 +56,7 @@ void lv_task_init(void) */ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "lv_task_handler started"); -#endif + LV_LOG_TRACE("lv_task_handler started"); static uint32_t idle_period_start = 0; static uint32_t handler_start = 0; @@ -134,9 +131,7 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_DEBUG, __FILE__, __LINE__, "lv_task_handler finished"); -#endif + LV_LOG_TRACE("lv_task_handler ready"); } /** diff --git a/lv_objx/lv_arc.c b/lv_objx/lv_arc.c index 951175549..9dabd7e4a 100644 --- a/lv_objx/lv_arc.c +++ b/lv_objx/lv_arc.c @@ -51,9 +51,7 @@ static lv_design_func_t ancestor_design; lv_obj_t * lv_arc_create(lv_obj_t * par, lv_obj_t * copy) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Arc create stared"); -#endif + LV_LOG_TRACE("arc create started"); /*Create the ancestor of arc*/ lv_obj_t * new_arc = lv_obj_create(par, copy); @@ -90,9 +88,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_arc); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Arc create ready"); -#endif + LV_LOG_INFO("arc created"); return new_arc; } diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 1f8ca838c..975c9b9bd 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -52,10 +52,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Bar create stared"); -#endif + LV_LOG_TRACE("lv_bar create started"); /*Create the ancestor basic object*/ lv_obj_t * new_bar = lv_obj_create(par, copy); @@ -103,9 +100,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy) lv_bar_set_value(new_bar, ext->cur_value); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Bar create ready"); -#endif + LV_LOG_INFO("bar created"); return new_bar; } diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index 12832b19e..ecdef4c4d 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -67,10 +67,7 @@ static lv_point_t ink_point; */ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Button create stared"); -#endif + LV_LOG_TRACE("button create started"); lv_obj_t * new_btn; @@ -140,10 +137,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_btn); } - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Button create raedy"); -#endif + LV_LOG_INFO("button created"); return new_btn; } diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 1519b286d..7de090641 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -64,10 +64,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Button matrix create stared"); -#endif + LV_LOG_TRACE("button matrix create started"); /*Create the ancestor object*/ lv_obj_t * new_btnm = lv_obj_create(par, copy); @@ -126,9 +123,8 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) ext->btn_id_tgl = copy_ext->btn_id_tgl; lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy)); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Button matrix create ready"); -#endif + + LV_LOG_INFO("button matrix created"); return new_btnm; } diff --git a/lv_objx/lv_calendar.c b/lv_objx/lv_calendar.c index 3078759e0..2b778b850 100644 --- a/lv_objx/lv_calendar.c +++ b/lv_objx/lv_calendar.c @@ -70,10 +70,7 @@ static const char * month_name[12] = {"January", "February", "March", "Ap */ lv_obj_t * lv_calendar_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Calendar create stared"); -#endif + LV_LOG_TRACE("calendar create started"); /*Create the ancestor of calendar*/ lv_obj_t * new_calendar = lv_obj_create(par, copy); @@ -144,10 +141,7 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_calendar); } - #if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Calendar create ready"); -#endif - + LV_LOG_INFO("calendar created"); return new_calendar; } diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index 1c9f2f1a3..19699560f 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -51,9 +51,7 @@ static lv_signal_func_t ancestor_signal; lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Check box create stared"); -#endif + LV_LOG_TRACE("check box create started"); /*Create the ancestor basic object*/ lv_obj_t * new_cb = lv_btn_create(par, copy); @@ -110,10 +108,8 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_set_design_func(ext->bullet, lv_bullet_design); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Check box create ready"); -#endif + LV_LOG_INFO("check box created"); return new_cb; } diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index ea03d543a..b4d1f983c 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -58,9 +58,8 @@ static lv_signal_func_t ancestor_signal; lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Chart create stared"); -#endif + + LV_LOG_TRACE("chart create started"); /*Create the ancestor basic object*/ lv_obj_t * new_chart = lv_obj_create(par, copy); @@ -116,9 +115,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_chart); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Chart create ready"); -#endif + LV_LOG_INFO("chart created"); return new_chart; diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index e00b6c0ea..d8c72f840 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -63,9 +63,8 @@ static lv_signal_func_t ancestor_signal; lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Container create stared"); -#endif + + LV_LOG_TRACE("container create started"); /*Create a basic object*/ lv_obj_t * new_cont = lv_obj_create(par, copy); @@ -106,11 +105,10 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_cont); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Container create ready"); -#endif + LV_LOG_INFO("container created"); - return new_cont; + + return new_cont; } /*===================== diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 92bfab375..700d22ecc 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -66,10 +66,7 @@ static lv_design_func_t ancestor_design; */ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Drop down list create stared"); -#endif + LV_LOG_TRACE("drop down list create started"); /*Create the ancestor drop down list*/ lv_obj_t * new_ddlist = lv_page_create(par, copy); @@ -143,9 +140,8 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_ddlist); } - #if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Drop down list create ready"); -#endif + LV_LOG_INFO("drop down list created"); + return new_ddlist; } diff --git a/lv_objx/lv_gauge.c b/lv_objx/lv_gauge.c index 2b54d7bf0..7cd3af3ef 100644 --- a/lv_objx/lv_gauge.c +++ b/lv_objx/lv_gauge.c @@ -60,10 +60,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Gauge create stared"); -#endif + LV_LOG_TRACE("gauge create started"); /*Create the ancestor gauge*/ lv_obj_t * new_gauge = lv_lmeter_create(par, copy); @@ -116,9 +113,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_gauge); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Gauge create ready"); -#endif + LV_LOG_INFO("gauge created"); return new_gauge; } diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 307f41c82..c9e914e72 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -54,10 +54,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Image create stared"); -#endif + LV_LOG_TRACE("image create started"); lv_obj_t * new_img = NULL; @@ -102,9 +99,8 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_img); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Image create ready"); -#endif + + LV_LOG_INFO("image created"); return new_img; } diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index bd4968433..940b69abc 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -75,10 +75,7 @@ static const char * kb_map_num[] = { */ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Keyboard create stared"); -#endif + LV_LOG_TRACE("keyboard create started"); /*Create the ancestor of keyboard*/ lv_obj_t * new_kb = lv_btnm_create(par, copy); @@ -137,9 +134,9 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_kb); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Keyboard create ready"); -#endif + + LV_LOG_INFO("keyboard created"); + return new_kb; } diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index 499c4b5de..4fe833396 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -64,10 +64,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Label create stared"); -#endif + LV_LOG_TRACE("label create started"); /*Create a basic object*/ lv_obj_t * new_label = lv_obj_create(par, copy); @@ -128,10 +125,8 @@ lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_label); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Label create ready"); -#endif + LV_LOG_INFO("label created"); return new_label; } diff --git a/lv_objx/lv_led.c b/lv_objx/lv_led.c index 9526f50ab..f50e4778d 100644 --- a/lv_objx/lv_led.c +++ b/lv_objx/lv_led.c @@ -52,10 +52,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Led create stared"); -#endif + LV_LOG_TRACE("led create started"); /*Create the ancestor basic object*/ lv_obj_t * new_led = lv_obj_create(par, copy); @@ -96,9 +93,8 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_led); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Led create ready"); -#endif + + LV_LOG_INFO("led created"); return new_led; } diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index 40f0d8941..b2bb17334 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -50,10 +50,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Line create stared"); -#endif + LV_LOG_TRACE("line create started"); /*Create a basic object*/ lv_obj_t * new_line = lv_obj_create(par, copy); @@ -92,9 +89,8 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_line); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Line create ready"); -#endif + + LV_LOG_INFO("line created"); return new_line; } diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index a20b01cb5..3b6f228fa 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -71,10 +71,7 @@ static lv_obj_t * last_clicked_btn; */ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "List create stared"); -#endif + LV_LOG_TRACE("list create started"); /*Create the ancestor basic object*/ lv_obj_t * new_list = lv_page_create(par, copy); @@ -143,9 +140,9 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_list); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "List create ready"); -#endif + + LV_LOG_INFO("list created"); + return new_list; } diff --git a/lv_objx/lv_lmeter.c b/lv_objx/lv_lmeter.c index 913573ba7..d80840700 100644 --- a/lv_objx/lv_lmeter.c +++ b/lv_objx/lv_lmeter.c @@ -52,10 +52,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Line meter create stared"); -#endif + LV_LOG_TRACE("line meter create started"); /*Create the ancestor of line meter*/ lv_obj_t * new_lmeter = lv_obj_create(par, copy); @@ -105,9 +102,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_lmeter); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Line meter create ready"); -#endif + LV_LOG_INFO("line meter created"); return new_lmeter; } diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index f4de404ea..f2e669c8f 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -60,10 +60,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Message box create stared"); -#endif + LV_LOG_TRACE("mesasge box create started"); /*Create the ancestor message box*/ lv_obj_t * new_mbox = lv_cont_create(par, copy); @@ -118,9 +115,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_mbox); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Message box create ready"); -#endif + + LV_LOG_INFO("mesasge box created"); return new_mbox; } diff --git a/lv_objx/lv_objx_templ.c b/lv_objx/lv_objx_templ.c index c86c25c4f..2c7bf0396 100644 --- a/lv_objx/lv_objx_templ.c +++ b/lv_objx/lv_objx_templ.c @@ -53,10 +53,7 @@ static lv_design_func_t ancestor_design; */ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "template create stared"); -#endif + LV_LOG_TRACE("template create started"); /*Create the ancestor of template*/ /*TODO modify it to the ancestor create function */ @@ -87,9 +84,9 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy) /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_templ); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "template create ready"); -#endif + + LV_LOG_INFO("template created"); + return new_templ; } diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index c3eaea1f0..7fe973fb0 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -57,10 +57,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Page create stared"); -#endif + LV_LOG_TRACE("page create started"); /*Create the ancestor object*/ lv_obj_t * new_page = lv_cont_create(par, copy); @@ -145,10 +142,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy) lv_page_sb_refresh(new_page); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Page create ready"); -#endif - + LV_LOG_INFO("page created"); return new_page; } diff --git a/lv_objx/lv_preload.c b/lv_objx/lv_preload.c index 9867cac0e..9de13a13d 100644 --- a/lv_objx/lv_preload.c +++ b/lv_objx/lv_preload.c @@ -55,10 +55,7 @@ static lv_design_func_t ancestor_design; */ lv_obj_t * lv_preload_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Preloader create stared"); -#endif + LV_LOG_TRACE("preload create started"); /*Create the ancestor of pre loader*/ lv_obj_t * new_preload = lv_arc_create(par, copy); @@ -109,9 +106,8 @@ lv_obj_t * lv_preload_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_preload); } - #if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Preloader create ready"); -#endif + + LV_LOG_INFO("preload created"); return new_preload; } diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 671ac624c..32c22eec7 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -60,10 +60,7 @@ static lv_signal_func_t ancestor_scrl_signal; */ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Roller create stared"); -#endif + LV_LOG_TRACE("roller create started"); /*Create the ancestor of roller*/ lv_obj_t * new_roller = lv_ddlist_create(par, copy); @@ -114,9 +111,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_roller); /*Refresh the style with new signal function*/ } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Roller create ready"); -#endif + + LV_LOG_INFO("roller created"); + return new_roller; } diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 841952060..b400d6763 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -53,10 +53,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Slider create stared"); -#endif + LV_LOG_TRACE("slider create started"); /*Create the ancestor slider*/ lv_obj_t * new_slider = lv_bar_create(par, copy); @@ -106,9 +103,9 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_slider); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Slider create ready"); -#endif + + LV_LOG_INFO("slider created"); + return new_slider; } diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index bac852a19..b9ff4ed23 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -50,10 +50,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Switch create stared"); -#endif + LV_LOG_TRACE("switch create started"); /*Create the ancestor of switch*/ lv_obj_t * new_sw = lv_slider_create(par, copy); @@ -105,9 +102,7 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_sw); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Switch create ready"); -#endif + LV_LOG_INFO("switch created"); return new_sw; } diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 647efc327..82811fcff 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -74,10 +74,7 @@ static lv_signal_func_t scrl_signal; */ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Text area create stared"); -#endif + LV_LOG_TRACE("text area create started"); /*Create the ancestor object*/ lv_obj_t * new_ta = lv_page_create(par, copy); @@ -167,10 +164,8 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) lv_anim_create(&a); #endif + LV_LOG_INFO("text area created"); -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Text area create ready"); -#endif return new_ta; } @@ -188,9 +183,7 @@ void lv_ta_add_char(lv_obj_t * ta, char c) lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); if(ext->one_line && (c == '\n' || c == '\n')) { -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, "Text area: line break ignored in one-line mode"); -#endif + LV_LOG_INFO("Text area: line break ignored in one-line mode"); return; } diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index f003ce430..e878cd5d0 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -66,11 +66,7 @@ static const char * tab_def[] = {""}; */ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Tabview create stared"); -#endif - + LV_LOG_TRACE("tab view create started"); /*Create the ancestor of tab*/ lv_obj_t * new_tabview = lv_obj_create(par, copy); @@ -176,9 +172,8 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_tabview); } -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Tabview create ready"); -#endif + + LV_LOG_INFO("tab view created"); return new_tabview; } diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index f1c4ada5b..87feea42a 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -46,11 +46,7 @@ static lv_signal_func_t ancestor_signal; */ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) { - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, "Window create stared"); -#endif - + LV_LOG_TRACE("window create started"); /*Create the ancestor object*/ lv_obj_t * new_win = lv_obj_create(par, copy); @@ -140,11 +136,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy) lv_win_realign(new_win); - - -#if USE_LV_LOG - lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, "Window create ready"); -#endif + LV_LOG_INFO("window created"); return new_win; } diff --git a/lvgl.h b/lvgl.h index b168a8d50..ceee7358b 100644 --- a/lvgl.h +++ b/lvgl.h @@ -15,6 +15,7 @@ extern "C" { *********************/ /*Test misc. module version*/ +#include "lv_misc/lv_log.h" #include "lv_misc/lv_task.h" #include "lv_hal/lv_hal.h"