From df5a47871d62f4314837e4babab9d4f7e8d49d90 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 28 Feb 2021 15:02:00 +0100 Subject: [PATCH] add some logs --- examples/widgets/list/lv_example_list_1.c | 2 +- src/extra/layouts/flex/lv_flex.c | 2 +- src/lv_core/lv_obj.c | 4 ++++ src/lv_core/lv_obj_class.c | 3 ++- src/lv_core/lv_obj_style.c | 4 +++- src/lv_misc/lv_mem.c | 5 +++-- src/lv_misc/lv_timer.c | 10 ++++++++-- 7 files changed, 22 insertions(+), 8 deletions(-) diff --git a/examples/widgets/list/lv_example_list_1.c b/examples/widgets/list/lv_example_list_1.c index 8da20c146..91face9e4 100644 --- a/examples/widgets/list/lv_example_list_1.c +++ b/examples/widgets/list/lv_example_list_1.c @@ -5,7 +5,7 @@ static lv_obj_t * list1; static void event_handler(lv_obj_t * obj, lv_event_t event) { if(event == LV_EVENT_CLICKED) { - LV_LOG_USER("Clicked: %s\n", lv_list_get_btn_text(list1, obj)); + LV_LOG_USER("Clicked: %s", lv_list_get_btn_text(list1, obj)); } } void lv_example_list_1(void) diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index cd26f4b00..f08b61f69 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -159,7 +159,7 @@ static void flex_update(lv_obj_t * cont, lv_obj_t * item) if(cont->spec_attr == NULL) return; const lv_flex_t * f = (const lv_flex_t *)cont->spec_attr->layout_dsc; - LV_LOG_INFO("Flex update on 0x%p", cont); + LV_LOG_INFO("Flex update on 0x%p triggered by 0x%p", cont, item); bool rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false; bool row = f->dir == LV_FLEX_FLOW_ROW ? true : false; diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 36831e860..ec6f991ff 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -188,6 +188,8 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param) LV_ASSERT_OBJ(obj, MY_CLASS); + LV_LOG_TRACE("Sending event %d to 0x%p with 0x%p param", event, obj, param); + /*Nothing to do if no event function and not bubbled*/ lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0); if(event_dsc == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) == false) { @@ -287,6 +289,8 @@ lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param) { if(obj == NULL) return LV_RES_OK; + LV_LOG_TRACE("Sending signal %d to 0x%p with 0x%p param", signal, obj, param); + const lv_obj_class_t * class_p = obj->class_p; while(class_p && class_p->signal_cb == NULL) class_p = class_p->base_class; diff --git a/src/lv_core/lv_obj_class.c b/src/lv_core/lv_obj_class.c index adbf828e1..a32ab72dd 100644 --- a/src/lv_core/lv_obj_class.c +++ b/src/lv_core/lv_obj_class.c @@ -42,6 +42,7 @@ static uint32_t get_instance_size(const lv_obj_class_t * class_p); lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * parent, const lv_obj_t * copy) { + LV_LOG_TRACE("Creating object with 0x%p class on 0x%p parent", class_p, parent); uint32_t s = get_instance_size(class_p); lv_obj_t * obj = lv_mem_alloc(s); lv_memset_00(obj, s); @@ -51,7 +52,6 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p while(class_start && class_start->constructor_cb == NULL) class_start = class_start->base_class; -// class_start->constructor_cb(obj, parent, copy); lv_obj_construct(obj, parent, copy); if(parent) { @@ -66,6 +66,7 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p if(!copy) lv_theme_apply(obj); // else lv_style_list_copy(&checkbox->style_indic, &checkbox_copy->style_indic); + LV_LOG_TRACE("Object created at 0x%p address with 0x%p class on 0x%p parent", obj, class_p, parent); return obj; } diff --git a/src/lv_core/lv_obj_style.c b/src/lv_core/lv_obj_style.c index 291ba4ddf..1b5fb0cc9 100644 --- a/src/lv_core/lv_obj_style.c +++ b/src/lv_core/lv_obj_style.c @@ -184,7 +184,9 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop) if(prop == LV_STYLE_PROP_ALL || ((prop & LV_STYLE_PROP_INHERIT) && (prop & LV_STYLE_PROP_EXT_DRAW) && (prop & LV_STYLE_PROP_LAYOUT_REFR))) { - refresh_children_style(obj); + if(part != LV_PART_SCROLLBAR) { + refresh_children_style(obj); + } } } diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index 41f9a3895..bfe112894 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -166,9 +166,10 @@ void * lv_mem_alloc(size_t size) #if LV_MEM_CUSTOM == 0 alloc = alloc_core(size); if(alloc == NULL) { - LV_LOG_TRACE("No more memory, try to defrag"); + LV_LOG_WARN("Out of memory, try to defrag"); lv_mem_defrag(); alloc = alloc_core(size); + LV_LOG_INFO("Defrag made enough memory"); } #else @@ -195,7 +196,7 @@ void * lv_mem_alloc(size_t size) LV_LOG_WARN("Couldn't allocate memory (%d bytes)", size); lv_mem_monitor_t mon; lv_mem_monitor(&mon); - LV_LOG_WARN("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n", + LV_LOG_WARN("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d", (int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct, (int)mon.free_biggest_size); } diff --git a/src/lv_misc/lv_timer.c b/src/lv_misc/lv_timer.c index 3e4921709..583876539 100644 --- a/src/lv_misc/lv_timer.c +++ b/src/lv_misc/lv_timer.c @@ -90,7 +90,10 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) if(lv_timer_exec(LV_GC_ROOT(_lv_timer_act))) { /*If a timer was created or deleted then this or the next item might be corrupted*/ - if(timer_created || timer_deleted) break; + if(timer_created || timer_deleted) { + LV_LOG_TRACE("Start from the first timer again because a timer was created or deleted"); + break; + } } LV_GC_ROOT(_lv_timer_act) = next; /*Load the next timer*/ @@ -120,7 +123,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) already_running = false; /*Release the mutex*/ - LV_LOG_TRACE("lv_timer_handler ready"); + LV_LOG_TRACE("lv_timer_handler ready. %d ms until the next timer call", time_till_next); return time_till_next; } /** @@ -277,7 +280,9 @@ static bool lv_timer_exec(lv_timer_t * timer) bool exec = false; if(lv_timer_time_remaining(timer) == 0) { timer->last_run = lv_tick_get(); + LV_LOG_TRACE("Calling timer callback 0x%p", timer->timer_cb); if(timer->timer_cb) timer->timer_cb(timer); + LV_LOG_TRACE("Timer callback 0x%p finished", timer->timer_cb); LV_ASSERT_MEM_INTEGRITY(); /*Delete if it was a one shot lv_timer*/ @@ -286,6 +291,7 @@ static bool lv_timer_exec(lv_timer_t * timer) timer->repeat_count--; } if(timer->repeat_count == 0) { + LV_LOG_TRACE("Deleting timer with 0x%p callback because the repeat count is over", timer->timer_cb); lv_timer_del(timer); } }