From 6f9d66843c5f6ea0510e5c11de7ff192e8e59220 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 11 Dec 2019 05:17:30 +0100 Subject: [PATCH 1/8] kb: fix deafult map --- src/lv_objx/lv_kb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lv_objx/lv_kb.c b/src/lv_objx/lv_kb.c index 69da60089..28e2614cf 100644 --- a/src/lv_objx/lv_kb.c +++ b/src/lv_objx/lv_kb.c @@ -147,6 +147,9 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb); lv_obj_set_base_dir(new_kb, LV_BIDI_DIR_LTR); + lv_btnm_set_map(new_kb, kb_map[ext->mode]); + lv_btnm_set_ctrl_map(new_kb, kb_ctrl[ext->mode]); + /*Set the default styles*/ lv_theme_t * th = lv_theme_get_current(); if(th) { @@ -168,6 +171,9 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy) ext->mode = copy_ext->mode; ext->cursor_mng = copy_ext->cursor_mng; + lv_btnm_set_map(new_kb, kb_map[ext->mode]); + lv_btnm_set_ctrl_map(new_kb, kb_ctrl[ext->mode]); + /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_kb); } From f8c67bcc12c14449ec3051a3596fe0986ae52331 Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:46:33 -0800 Subject: [PATCH 2/8] made lv_slider_draw_knob params const --- src/lv_objx/lv_slider.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lv_objx/lv_slider.c b/src/lv_objx/lv_slider.c index 79a00042f..1b5343969 100644 --- a/src/lv_objx/lv_slider.c +++ b/src/lv_objx/lv_slider.c @@ -33,7 +33,7 @@ static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode); static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param); static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); -static void lv_slider_draw_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_area_t * clip_area); +static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area); /********************** * STATIC VARIABLES @@ -491,7 +491,7 @@ static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv knob_area->y2 += style_knob->body.padding.bottom; } -static void lv_slider_draw_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_area_t * clip_area) { +static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area) { lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider); const lv_style_t * style_knob = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB); lv_opa_t opa_scale = lv_obj_get_opa_scale(slider); From 145864f8725f90142d91d86364fda6eb3038d519 Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:48:40 -0800 Subject: [PATCH 3/8] made default kb maps const also changed "Bksp" -> LV_SYMBOL_BACKSPACE --- src/lv_objx/lv_kb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_objx/lv_kb.c b/src/lv_objx/lv_kb.c index 28e2614cf..4f23ad0b7 100644 --- a/src/lv_objx/lv_kb.c +++ b/src/lv_objx/lv_kb.c @@ -36,7 +36,7 @@ static void lv_kb_updatemap(lv_obj_t * kb); **********************/ static lv_signal_cb_t ancestor_signal; /* clang-format off */ -static const char * default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n", +static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n", "ABC", "a", "s", "d", "f", "g", "h", "j", "k", "l", LV_SYMBOL_NEW_LINE, "\n", "_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n", LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""}; @@ -47,7 +47,7 @@ static const lv_btnm_ctrl_t default_kb_ctrl_lc_map[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2}; -static const char * default_kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n", +static const char * const default_kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n", "abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n", "_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n", LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""}; @@ -58,7 +58,7 @@ static const lv_btnm_ctrl_t default_kb_ctrl_uc_map[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, LV_KB_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KB_CTRL_BTN_FLAGS | 2}; -static const char * default_kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", "Bksp", "\n", +static const char * const default_kb_map_spec[] = {"0", "1", "2", "3", "4" ,"5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n", "abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n", "\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n", LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""}; From 92a0ef4be38e54bdd85b0e8a26af76107e09e95b Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:49:22 -0800 Subject: [PATCH 4/8] removed repeated line --- src/lv_objx/lv_chart.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index 20ea4980e..44d2ee2b8 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -188,8 +188,6 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color) lv_coord_t def = LV_CHART_POINT_DEF; - if(ser == NULL) return NULL; - ser->color = color; ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt); LV_ASSERT_MEM(ser->points); From 63009588c0706fef581058ef5be209e04ed264fe Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:51:07 -0800 Subject: [PATCH 5/8] removed unused function prototype --- src/lv_core/lv_indev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 45496a1eb..14579f071 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -39,7 +39,6 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data); static void indev_proc_press(lv_indev_proc_t * proc); static void indev_proc_release(lv_indev_proc_t * proc); static void indev_proc_reset_query_handler(lv_indev_t * indev); -static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj); static void indev_drag(lv_indev_proc_t * proc); static void indev_drag_throw(lv_indev_proc_t * proc); static lv_obj_t * get_dragged_obj(lv_obj_t * obj); From 9f447e8a4e5ec2ac5e0b95dc59fab61c3564afd6 Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:53:18 -0800 Subject: [PATCH 6/8] changed fn ptr return type from false to NULL --- src/lv_core/lv_group.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index fc8bfda49..eb74a8977 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -442,7 +442,7 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group) */ lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group) { - if(!group) return false; + if(!group) return NULL; return group->style_mod_cb; } @@ -453,7 +453,7 @@ lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group) */ lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group) { - if(!group) return false; + if(!group) return NULL; return group->style_mod_edit_cb; } @@ -464,7 +464,7 @@ lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group) */ lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group) { - if(!group) return false; + if(!group) return NULL; return group->focus_cb; } From dd9d655b3ddb91feaae5341ae7d6c78974aae8c3 Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:54:26 -0800 Subject: [PATCH 7/8] removed redundent line --- src/lv_objx/lv_chart.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index 44d2ee2b8..7e2134bb7 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -931,7 +931,6 @@ static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask) lv_style_copy(&style_point, &lv_style_plain); style_point.body.border.width = 0; - style_point.body.radius = LV_RADIUS_CIRCLE; style_point.body.opa = ext->series.opa; style_point.body.radius = ext->series.width; From 226e566ebd9e873d33ba4448fe6c88ddaee2c13b Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Mon, 16 Dec 2019 07:55:19 -0800 Subject: [PATCH 8/8] removed redundent test for NULL --- src/lv_misc/lv_ll.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lv_misc/lv_ll.c b/src/lv_misc/lv_ll.c index 8e2d612f8..57cbfa418 100644 --- a/src/lv_misc/lv_ll.c +++ b/src/lv_misc/lv_ll.c @@ -136,7 +136,6 @@ void * lv_ll_ins_tail(lv_ll_t * ll_p) lv_ll_node_t * n_new; n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); - if(n_new == NULL) return NULL; if(n_new != NULL) { node_set_next(ll_p, n_new, NULL); /*No next after the new tail*/