add some logs

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-28 15:02:00 +01:00
parent 468fdb4f74
commit df5a47871d
7 changed files with 22 additions and 8 deletions

View File

@@ -5,7 +5,7 @@ static lv_obj_t * list1;
static void event_handler(lv_obj_t * obj, lv_event_t event) static void event_handler(lv_obj_t * obj, lv_event_t event)
{ {
if(event == LV_EVENT_CLICKED) { 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) void lv_example_list_1(void)

View File

@@ -159,7 +159,7 @@ static void flex_update(lv_obj_t * cont, lv_obj_t * item)
if(cont->spec_attr == NULL) return; if(cont->spec_attr == NULL) return;
const lv_flex_t * f = (const lv_flex_t *)cont->spec_attr->layout_dsc; 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 rtl = lv_obj_get_base_dir(cont) == LV_BIDI_DIR_RTL ? true : false;
bool row = f->dir == LV_FLEX_FLOW_ROW ? true : false; bool row = f->dir == LV_FLEX_FLOW_ROW ? true : false;

View File

@@ -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_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*/ /*Nothing to do if no event function and not bubbled*/
lv_event_dsc_t * event_dsc = lv_obj_get_event_dsc(obj, 0); 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) { 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; 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; const lv_obj_class_t * class_p = obj->class_p;
while(class_p && class_p->signal_cb == NULL) class_p = class_p->base_class; while(class_p && class_p->signal_cb == NULL) class_p = class_p->base_class;

View File

@@ -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_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); uint32_t s = get_instance_size(class_p);
lv_obj_t * obj = lv_mem_alloc(s); lv_obj_t * obj = lv_mem_alloc(s);
lv_memset_00(obj, 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; 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); lv_obj_construct(obj, parent, copy);
if(parent) { 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); if(!copy) lv_theme_apply(obj);
// else lv_style_list_copy(&checkbox->style_indic, &checkbox_copy->style_indic); // 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; return obj;
} }

View File

@@ -184,8 +184,10 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
if(prop == LV_STYLE_PROP_ALL || if(prop == LV_STYLE_PROP_ALL ||
((prop & LV_STYLE_PROP_INHERIT) && (prop & LV_STYLE_PROP_EXT_DRAW) && (prop & LV_STYLE_PROP_LAYOUT_REFR))) ((prop & LV_STYLE_PROP_INHERIT) && (prop & LV_STYLE_PROP_EXT_DRAW) && (prop & LV_STYLE_PROP_LAYOUT_REFR)))
{ {
if(part != LV_PART_SCROLLBAR) {
refresh_children_style(obj); refresh_children_style(obj);
} }
}
} }
void lv_obj_enable_style_refresh(bool en) void lv_obj_enable_style_refresh(bool en)

View File

@@ -166,9 +166,10 @@ void * lv_mem_alloc(size_t size)
#if LV_MEM_CUSTOM == 0 #if LV_MEM_CUSTOM == 0
alloc = alloc_core(size); alloc = alloc_core(size);
if(alloc == NULL) { if(alloc == NULL) {
LV_LOG_TRACE("No more memory, try to defrag"); LV_LOG_WARN("Out of memory, try to defrag");
lv_mem_defrag(); lv_mem_defrag();
alloc = alloc_core(size); alloc = alloc_core(size);
LV_LOG_INFO("Defrag made enough memory");
} }
#else #else
@@ -195,7 +196,7 @@ void * lv_mem_alloc(size_t size)
LV_LOG_WARN("Couldn't allocate memory (%d bytes)", size); LV_LOG_WARN("Couldn't allocate memory (%d bytes)", size);
lv_mem_monitor_t mon; lv_mem_monitor_t mon;
lv_mem_monitor(&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.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
(int)mon.free_biggest_size); (int)mon.free_biggest_size);
} }

View File

@@ -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(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 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*/ 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*/ 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; return time_till_next;
} }
/** /**
@@ -277,7 +280,9 @@ static bool lv_timer_exec(lv_timer_t * timer)
bool exec = false; bool exec = false;
if(lv_timer_time_remaining(timer) == 0) { if(lv_timer_time_remaining(timer) == 0) {
timer->last_run = lv_tick_get(); 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); if(timer->timer_cb) timer->timer_cb(timer);
LV_LOG_TRACE("Timer callback 0x%p finished", timer->timer_cb);
LV_ASSERT_MEM_INTEGRITY(); LV_ASSERT_MEM_INTEGRITY();
/*Delete if it was a one shot lv_timer*/ /*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--; timer->repeat_count--;
} }
if(timer->repeat_count == 0) { 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); lv_timer_del(timer);
} }
} }