From bf00102f83696e6bc032efed0bc6b73a820a13b0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 17 Oct 2018 12:41:18 +0200 Subject: [PATCH 1/7] lv_ta: cursor type bit size fix --- lv_objx/lv_ta.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index b97c67c49..284dcacec 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -49,7 +49,7 @@ enum { LV_CURSOR_BLOCK, LV_CURSOR_OUTLINE, LV_CURSOR_UNDERLINE, - LV_CURSOR_HIDDEN = 0x10, /*Or it to any value to hide the cursor temporally*/ + LV_CURSOR_HIDDEN = 0x08, /*Or it to any value to hide the cursor temporally*/ }; typedef uint8_t lv_cursor_type_t; @@ -68,7 +68,7 @@ typedef struct lv_style_t *style; /*Style of the cursor (NULL to use label's style)*/ lv_coord_t valid_x; /*Used when stepping up/down in text area when stepping to a shorter line. (Handled by the library)*/ uint16_t pos; /*The current cursor position (0: before 1. letter; 1: before 2. letter etc.)*/ - lv_cursor_type_t type:3; /*Shape of the cursor*/ + lv_cursor_type_t type:4; /*Shape of the cursor*/ uint8_t state :1; /*Indicates that the cursor is visible now or not (Handled by the library)*/ } cursor; } lv_ta_ext_t; From 88b8e982b485368cc873860ba602a4cd315d674f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 17 Oct 2018 14:31:16 +0200 Subject: [PATCH 2/7] lv_task and lv_ll: stability improvents --- lv_misc/lv_ll.c | 5 ++++- lv_misc/lv_task.c | 47 ++++++++++++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lv_misc/lv_ll.c b/lv_misc/lv_ll.c index d12de91f1..fd5561fb3 100644 --- a/lv_misc/lv_ll.c +++ b/lv_misc/lv_ll.c @@ -321,7 +321,10 @@ void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after) if(n_act == n_after) return; /*Can't move before itself*/ - void * n_before = lv_ll_get_prev(ll_p, n_after); + void * n_before; + if(n_after != NULL) n_before = lv_ll_get_prev(ll_p, n_after); + else n_before = lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/ + if(n_act == n_before) return; /*Already before `n_after`*/ /*It's much easier to remove from the list and add again*/ diff --git a/lv_misc/lv_task.c b/lv_misc/lv_task.c index c2a9a48b6..160e066bc 100644 --- a/lv_misc/lv_task.c +++ b/lv_misc/lv_task.c @@ -32,6 +32,8 @@ static lv_ll_t lv_task_ll; /*Linked list to store the lv_tasks*/ static bool lv_task_run = false; static uint8_t idle_last = 0; static bool task_deleted; +static bool task_created; +static lv_task_t * task_act; /********************** * MACROS @@ -80,33 +82,35 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) bool end_flag; do { end_flag = true; - lv_task_t * act = lv_ll_get_head(&lv_task_ll); - while(act) { + task_deleted = false; + task_created = false; + task_act = lv_ll_get_head(&lv_task_ll); + while(task_act) { /* The task might be deleted if it runs only once ('once = 1') * So get next element until the current is surely valid*/ - next = lv_ll_get_next(&lv_task_ll, act); + next = lv_ll_get_next(&lv_task_ll, task_act); /*We reach priority of the turned off task. There is nothing more to do.*/ - if(act->prio == LV_TASK_PRIO_OFF) { + if(task_act->prio == LV_TASK_PRIO_OFF) { break; } /*Here is the interrupter task. Don't execute it again.*/ - if(act == task_interrupter) { + if(task_act == task_interrupter) { task_interrupter = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/ - act = next; + task_act = next; continue; /*Load the next task*/ } /*Just try to run the tasks with highest priority.*/ - if(act->prio == LV_TASK_PRIO_HIGHEST) { - lv_task_exec(act); + if(task_act->prio == LV_TASK_PRIO_HIGHEST) { + lv_task_exec(task_act); } /*Tasks with higher priority then the interrupted shall be run in every case*/ else if(task_interrupter) { - if(act->prio > task_interrupter->prio) { - if(lv_task_exec(act)) { - task_interrupter = act; /*Check all tasks again from the highest priority */ + if(task_act->prio > task_interrupter->prio) { + if(lv_task_exec(task_act)) { + task_interrupter = task_act; /*Check all tasks again from the highest priority */ end_flag = false; break; } @@ -115,13 +119,17 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) /* It is no interrupter task or we already reached it earlier. * Just run the remaining tasks*/ else { - if(lv_task_exec(act)) { - task_interrupter = act; /*Check all tasks again from the highest priority */ + if(lv_task_exec(task_act)) { + task_interrupter = task_act; /*Check all tasks again from the highest priority */ end_flag = false; break; } } - act = next; /*Load the next task*/ + + if(task_deleted) break; /*If a task was deleted then this or the next item might be corrupted*/ + if(task_created) break; /*If a task was deleted then this or the next item might be corrupted*/ + + task_act = next; /*Load the next task*/ } } while(!end_flag); @@ -186,6 +194,8 @@ lv_task_t * lv_task_create(void (*task)(void *), uint32_t period, lv_task_prio_t new_lv_task->once = 0; new_lv_task->last_run = lv_tick_get(); + task_created = true; + return new_lv_task; } @@ -199,7 +209,7 @@ void lv_task_del(lv_task_t * lv_task_p) lv_mem_free(lv_task_p); - task_deleted = true; + if(task_act == lv_task_p) task_deleted = true; /*The active task was deleted*/ } /** @@ -301,12 +311,15 @@ static bool lv_task_exec(lv_task_t * lv_task_p) uint32_t elp = lv_tick_elaps(lv_task_p->last_run); if(elp >= lv_task_p->period) { lv_task_p->last_run = lv_tick_get(); - task_deleted = false; + task_deleted = false; + task_created = false; lv_task_p->task(lv_task_p->param); /*Delete if it was a one shot lv_task*/ if(task_deleted == false) { /*The task might be deleted by itself as well*/ - if(lv_task_p->once != 0) lv_task_del(lv_task_p); + if(lv_task_p->once != 0) { + lv_task_del(lv_task_p); + } } exec = true; } From 78428b523f355e79497bb1fd1e2b293d49812618 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 18 Oct 2018 06:59:41 +0200 Subject: [PATCH 3/7] lv_draw_img: fix to draw images with LV_COLOR_DEPTH 1 --- lv_draw/lv_draw_vbasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index a756ddb2a..e23f15eaa 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -483,7 +483,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, /*Calculate with the pixel level alpha*/ if(alpha_byte) { -#if LV_COLOR_DEPTH == 8 +#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1 px_color.full = px_color_p[0]; #elif LV_COLOR_DEPTH == 16 /*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/ From cd3f6340da721736a20772e62756e00bae9ad265 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 20 Oct 2018 00:38:56 +0200 Subject: [PATCH 4/7] add rc tag --- lvgl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lvgl.h b/lvgl.h index dbedb4f68..6e74d53fa 100644 --- a/lvgl.h +++ b/lvgl.h @@ -63,7 +63,7 @@ extern "C" { #define LVGL_VERSION_MAJOR 5 #define LVGL_VERSION_MINOR 2 #define LVGL_VERSION_PATCH 0 -#define LVGL_VERSION_INFO "" +#define LVGL_VERSION_INFO "rc" /********************** * TYPEDEFS From 436c09aa51c736c3a86d2c10b1258715ed86ed2c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 27 Oct 2018 11:11:08 +0200 Subject: [PATCH 5/7] lv_ll: fix comment typo --- lv_misc/lv_ll.c | 2 +- lv_misc/lv_ll.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lv_misc/lv_ll.c b/lv_misc/lv_ll.c index fd5561fb3..580beb1da 100644 --- a/lv_misc/lv_ll.c +++ b/lv_misc/lv_ll.c @@ -157,7 +157,7 @@ void * lv_ll_ins_tail(lv_ll_t * ll_p) /** * Remove the node 'node_p' from 'll_p' linked list. - * It Dose not free the the memory of node. + * It dose not free the the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ diff --git a/lv_misc/lv_ll.h b/lv_misc/lv_ll.h index 43f865182..5960132db 100644 --- a/lv_misc/lv_ll.h +++ b/lv_misc/lv_ll.h @@ -72,7 +72,7 @@ void * lv_ll_ins_tail(lv_ll_t * ll_p); /** * Remove the node 'node_p' from 'll_p' linked list. - * It Dose not free the the memory of node. + * It dose not free the the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ From 4f11ad7adb8f6abbf9f3a4cb2c6835fb54063405 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 28 Oct 2018 09:07:00 +0100 Subject: [PATCH 6/7] lv_draw_img: fix buffer size --- lv_draw/lv_draw_img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw_img.c b/lv_draw/lv_draw_img.c index 0f7fa5153..2d81dbbe3 100644 --- a/lv_draw/lv_draw_img.c +++ b/lv_draw/lv_draw_img.c @@ -305,7 +305,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas lv_coord_t width = lv_area_get_width(&mask_com); #if LV_COMPILER_VLA_SUPPORTED - uint8_t buf[(lv_area_get_width(&mask_com) * (LV_COLOR_SIZE + 1))]; + uint8_t buf[(lv_area_get_width(&mask_com) * ((LV_COLOR_DEPTH >> 3) + 1))]; #else uint8_t buf[LV_HOR_RES * ((LV_COLOR_DEPTH >> 3) + 1)]; /*+1 because of the possible alpha byte*/ #endif From fc319a45024f7fa7ce1a86385e731142590ad2d3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 28 Oct 2018 10:29:06 +0100 Subject: [PATCH 7/7] lv_tabview: add lv_res_t return value to prevent tab laoding on LV_RES_INV --- lv_objx/lv_tabview.c | 4 +++- lv_objx/lv_tabview.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 28aa76714..1988d3600 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -275,8 +275,10 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en) lv_style_t * style = lv_obj_get_style(ext->content); + lv_res_t res = LV_RES_OK; if(id >= ext->tab_cnt) id = ext->tab_cnt - 1; - if(ext->tab_load_action && id != ext->tab_cur) ext->tab_load_action(tabview, id); + if(ext->tab_load_action && id != ext->tab_cur) res = ext->tab_load_action(tabview, id); + if(res != LV_RES_OK) return; /*Prevent the tab loading*/ ext->tab_cur = id; diff --git a/lv_objx/lv_tabview.h b/lv_objx/lv_tabview.h index 0356f39c4..3c80ff346 100644 --- a/lv_objx/lv_tabview.h +++ b/lv_objx/lv_tabview.h @@ -42,8 +42,9 @@ extern "C" { * TYPEDEFS **********************/ -/* parametes: pointer to a tabview object, tab_id*/ -typedef void (*lv_tabview_action_t)(lv_obj_t *, uint16_t); +/* parametes: pointer to a tabview object, tab_id + * return: LV_RES_INV: to prevent the loading of the tab; LV_RES_OK: if everything is fine*/ +typedef lv_res_t (*lv_tabview_action_t)(lv_obj_t *, uint16_t); enum {