From 02d318e66dcfa5cc45573b54daf6d4bff670e030 Mon Sep 17 00:00:00 2001 From: Zaltora Date: Mon, 12 Mar 2018 11:40:24 +0100 Subject: [PATCH 01/20] Non constant declaration I got an error when compilation. I fix the compilation problem but a proper way to initialize this variable is maybe needed. maybe in lv_init ? You can fix it and close this pull request. --- lv_draw/lv_draw_rbasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw_rbasic.c b/lv_draw/lv_draw_rbasic.c index 890b8bd77..ea49cb40d 100644 --- a/lv_draw/lv_draw_rbasic.c +++ b/lv_draw/lv_draw_rbasic.c @@ -28,7 +28,7 @@ /********************** * STATIC VARIABLES **********************/ -static lv_color_t letter_bg_color = LV_COLOR_WHITE; +static lv_color_t letter_bg_color; /********************** * MACROS From 69c5373db0d828a1ebdf116efe723d241026dfe8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 12 Mar 2018 17:20:24 +0100 Subject: [PATCH 02/20] start v5.1.1 --- lvgl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lvgl.h b/lvgl.h index 73e74909c..13b1fc579 100644 --- a/lvgl.h +++ b/lvgl.h @@ -56,8 +56,8 @@ extern "C" { /*Current version of LittlevGL*/ #define LVGL_VERSION_MAJOR 5 #define LVGL_VERSION_MINOR 1 -#define LVGL_VERSION_PATCH 0 -#define LVGL_VERSION_INFO "" +#define LVGL_VERSION_PATCH 1 +#define LVGL_VERSION_INFO "beta" /********************** * TYPEDEFS From d58a83cda7a0bb766604128abf4d544016ccef33 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 21 Mar 2018 13:15:02 +0100 Subject: [PATCH 03/20] lv_mbox: Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT --- lv_objx/lv_btnm.c | 9 +++++---- lv_objx/lv_mbox.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 9587d4818..e54115786 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -602,7 +602,8 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) break; } } - ext->btn_id_pr = area_below; + + if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below; } lv_obj_invalidate(btnm); } else if(c == LV_GROUP_KEY_UP) { @@ -611,10 +612,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) if(ext->btn_id_pr == LV_BTNM_PR_NONE) { ext->btn_id_pr = 0; } else { - uint16_t area_above; + int16_t area_above; lv_coord_t pr_center = ext->button_areas[ext->btn_id_pr].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_pr]) >> 1); - for(area_above = ext->btn_id_pr; area_above > 0; area_above --) { + for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) { if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 && pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor && pr_center <= ext->button_areas[area_above].x2) @@ -622,7 +623,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) break; } } - ext->btn_id_pr = area_above; + if(area_above >= 0) ext->btn_id_pr = area_above; } lv_obj_invalidate(btnm); diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index a5edf996d..4c3e57f40 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -348,6 +348,16 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) { lv_res_t res; + /*Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT */ + char c_trans = 0; + if(sign == LV_SIGNAL_CONTROLL) { + c_trans = *((char*)param); + if(c_trans == LV_GROUP_KEY_DOWN) c_trans = LV_GROUP_KEY_LEFT; + if(c_trans == LV_GROUP_KEY_UP) c_trans = LV_GROUP_KEY_RIGHT; + + param = &c_trans; + } + /* Include the ancient signal function */ res = ancestor_signal(mbox, sign, param); if(res != LV_RES_OK) return res; @@ -356,7 +366,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) if(sign == LV_SIGNAL_CORD_CHG) { if(lv_obj_get_width(mbox) != lv_area_get_width(param)) { mbox_realign(mbox); - } } else if(sign == LV_SIGNAL_STYLE_CHG) { From ca95d76659b34e246099e27ef10b7762274d6f8f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 10:09:00 +0100 Subject: [PATCH 04/20] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED --- lv_conf_templ.h | 7 +++--- lv_draw/lv_draw.c | 51 ++++++++++++++++++++++++++++++++++++--- lv_themes/lv_theme_mono.c | 2 +- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index 9080437bc..fd4618211 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -81,9 +81,10 @@ #define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ -/*Compiler attributes*/ -#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */ -#define LV_ATTRIBUTE_TASK_HANDLER +/*Compiler settings*/ +#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ +#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ +#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ /*================ * THEME USAGE diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index b6c9108d1..186d82edf 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -448,7 +448,15 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, lv_coord_t row; uint32_t act_pos; +#if LV_COMPILER_VLA_SUPPORTED lv_color_t buf[lv_area_get_width(&mask_com)]; +#else +# if LV_HOR_RES > LV_VER_RES + lv_color_t buf[LV_HOR_RES]; +# else + lv_color_t buf[LV_VER_RES]; +# endif +#endif for(row = mask_com.y1; row <= mask_com.y2; row ++) { res = lv_fs_read(&file, buf, useful_data, &br); @@ -1713,8 +1721,15 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask if(radius != 0) radius -= LV_ANTIALIAS; swidth += LV_ANTIALIAS; - +#if LV_COMPILER_VLA_SUPPORTED lv_coord_t curve_x[radius + swidth + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ +#else +# if LV_HOR_RES > LV_VER_RES + lv_coord_t curve_x[LV_HOR_RES]; +# else + lv_coord_t curve_x[LV_VER_RES]; +# endif +#endif memset(curve_x, 0, sizeof(curve_x)); lv_point_t circ; lv_coord_t circ_tmp; @@ -1727,15 +1742,30 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask int16_t line; int16_t filter_width = 2 * swidth + 1; +#if LV_COMPILER_VLA_SUPPORTED uint32_t line_1d_blur[filter_width]; - +#else +# if LV_HOR_RES > LV_VER_RES + uint32_t line_1d_blur[LV_HOR_RES]; +# else + uint32_t line_1d_blur[LV_VER_RES]; +# endif +#endif /*1D Blur horizontally*/ for(line = 0; line < filter_width; line++) { line_1d_blur[line] = (uint32_t)((uint32_t)(filter_width - line) * (style->body.opa * 2) << SHADOW_OPA_EXTRA_PRECISION) / (filter_width * filter_width); } uint16_t col; +#if LV_COMPILER_VLA_SUPPORTED lv_opa_t line_2d_blur[radius + swidth]; +#else +# if LV_HOR_RES > LV_VER_RES + lv_opa_t line_2d_blur[LV_HOR_RES]; +# else + lv_opa_t line_2d_blur[LV_VER_RES]; +# endif +#endif lv_point_t point_rt; lv_point_t point_rb; @@ -1845,8 +1875,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma radius = lv_draw_cont_radius_corr(radius, width, height); radius += LV_ANTIALIAS * SHADOW_BOTTOM_AA_EXTRA_RADIUS; swidth += LV_ANTIALIAS; - +#if LV_COMPILER_VLA_SUPPORTED lv_coord_t curve_x[radius + 1]; /*Stores the 'x' coordinates of a quarter circle.*/ +#else +# if LV_HOR_RES > LV_VER_RES + lv_coord_t curve_x[LV_HOR_RES]; +# else + lv_coord_t curve_x[LV_VER_RES]; +# endif +#endif lv_point_t circ; lv_coord_t circ_tmp; lv_circ_init(&circ, &circ_tmp, radius); @@ -1857,7 +1894,15 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma } int16_t col; + #if LV_COMPILER_VLA_SUPPORTED lv_opa_t line_1d_blur[swidth]; +#else +# if LV_HOR_RES > LV_VER_RES + lv_opa_t line_1d_blur[LV_HOR_RES]; +# else + lv_opa_t line_1d_blur[LV_VER_RES]; +# endif +#endif for(col = 0; col < swidth; col++) { line_1d_blur[col] = (uint32_t)((uint32_t)(swidth - col) * style->body.opa / 2) / (swidth); diff --git a/lv_themes/lv_theme_mono.c b/lv_themes/lv_theme_mono.c index aedd79b1f..4fc020381 100644 --- a/lv_themes/lv_theme_mono.c +++ b/lv_themes/lv_theme_mono.c @@ -456,7 +456,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t *font) * Get a pointer to the theme * @return pointer to the theme */ -lv_theme_t * lv_theme_get_templ(void) +lv_theme_t * lv_theme_get_mono(void) { return &theme; } From 0d938168273366ff91b595aa40f16db6de037f92 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 10:37:00 +0100 Subject: [PATCH 05/20] lv_group_create: init focus_cb --- lv_core/lv_group.c | 10 ++++++---- lv_core/lv_obj.c | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 13595ae86..a4471c5c3 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -47,6 +47,7 @@ lv_group_t * lv_group_create(void) group->style_mod = style_mod_def; group->obj_focus = NULL; group->frozen = 0; + group->focus_cb = NULL; return group; } @@ -88,6 +89,10 @@ void lv_group_remove_obj(lv_obj_t * obj) lv_group_t * g = obj->group_p; if(g == NULL) return; + if(*g->obj_focus == obj) { + lv_group_focus_next(g); + } + /*Search the object and remove it from its group */ lv_obj_t ** i; LL_READ(g->obj_ll, i) { @@ -98,10 +103,7 @@ void lv_group_remove_obj(lv_obj_t * obj) } } - if(*g->obj_focus == obj) { - g->obj_focus = NULL; - lv_group_focus_next(g); - } + } /** diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 3273930ab..c7c84e57a 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -284,6 +284,11 @@ lv_res_t lv_obj_del(lv_obj_t * obj) lv_anim_del(obj, NULL); #endif + /*Delete from the group*/ + #if USE_LV_GROUP + if(obj->group_p != NULL) lv_group_remove_obj(obj); + #endif + /* Reset all input devices if * the currently pressed object is deleted*/ lv_indev_t * indev = lv_indev_next(NULL); From dd6bad1b6ed65e69cd93ac8ad6e69c17f21b98c1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 12:39:58 +0100 Subject: [PATCH 06/20] fix of 16 bit image draw with alpha byte --- lv_core/lv_group.c | 2 -- lv_draw/lv_draw_vbasic.c | 42 ++++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index a4471c5c3..c0902982d 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -102,8 +102,6 @@ void lv_group_remove_obj(lv_obj_t * obj) obj->group_p = NULL; } } - - } /** diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index f6a272243..3b5377237 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -167,7 +167,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, } /*Fill with opacity*/ else { - /*Use hw blend if present*/ + /*Use hw blend if present*/ if(lv_disp_is_mem_blend_supported()) { if(color_array_tmp[0].full != color.full || last_width != w) { uint16_t i; @@ -317,7 +317,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p, */ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte, - lv_color_t recolor, lv_opa_t recolor_opa) + lv_color_t recolor, lv_opa_t recolor_opa) { lv_area_t masked_a; bool union_ok; @@ -384,31 +384,43 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, for(row = masked_a.y1; row <= masked_a.y2; row++) { for(col = 0; col < map_useful_w; col++) { lv_opa_t opa_result = opa; - lv_color_t * px_color = (lv_color_t *) &map_p[(uint32_t)col * px_size_byte]; - - /*Handle chroma key*/ - if(chroma_key && px_color->full == chroma_key_color.full) continue; + uint8_t * px_color_p = (uint8_t *) &map_p[(uint32_t)col * px_size_byte]; + lv_color_t px_color; /*Calculate with the pixel level alpha*/ if(alpha_byte) { - lv_opa_t px_opa = (*(((uint8_t *) px_color) + LV_IMG_PX_SIZE_ALPHA_BYTE - 1)); +#if LV_COLOR_DEPTH == 8 + 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*/ + px_color.full = px_color_p[0] + (px_color_p[1] << 8); +#elif LV_COLOR_DEPTH == 24 + px_color = *((lv_color_t*)px_color_p); +#endif + lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1); if(px_opa == LV_OPA_TRANSP) continue; else if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8; } + else { + px_color = *((lv_color_t*)px_color_p); + } + + /*Handle chroma key*/ + if(chroma_key && px_color.full == chroma_key_color.full) continue; /*Re-color the pixel if required*/ if(recolor_opa != LV_OPA_TRANSP) { - if(last_img_px.full != px_color->full) { /*Minor acceleration: calculate only for new colors (save the last)*/ - last_img_px = *px_color; - recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa); - } + if(last_img_px.full != px_color.full) { /*Minor acceleration: calculate only for new colors (save the last)*/ + last_img_px = px_color; + recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa); + } if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = recolored_px.full; else vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result); } else { - if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col].full = px_color->full; - else vdb_buf_tmp[col] = lv_color_mix(*px_color, vdb_buf_tmp[col], opa_result); + if(opa_result == LV_OPA_COVER) vdb_buf_tmp[col] = px_color; + else vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); } @@ -441,8 +453,8 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len } else { uint32_t col; for(col = 0; col < length; col++) { - dest[col] = lv_color_mix(src[col], dest[col], opa); - } + dest[col] = lv_color_mix(src[col], dest[col], opa); + } } } From a4d77bec6b2efc773bfbcee2f6b12acc5af6afb4 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 14:41:55 +0100 Subject: [PATCH 07/20] Disable Visual Studio warnings --- lv_conf_templ.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index fd4618211..f69d16de7 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -243,6 +243,13 @@ /*Switch (dependencies: lv_slider)*/ #define USE_LV_SW 1 +/************************* + * Non-user section + *************************/ +#ifdef _MSC_VER /* Disable warnings for Visual Studio*/ +# define _CRT_SECURE_NO_WARNINGS +#endif + #endif /*LV_CONF_H*/ From e8a9d1bdc7fbd24ea45c62435c39e00bd16c467f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 14:45:15 +0100 Subject: [PATCH 08/20] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates --- lv_objx/lv_line.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index 105dc2d3c..d3de7b578 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -255,6 +255,11 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param) } buf->type[i] = "lv_line"; } + else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { + lv_style_t * style = lv_line_get_style(line); + if(line->ext_size < style->line.width) line->ext_size = style->line.width; + } + return res; } From d1889b77e5627ad501c7bdb3a595c21e8f5878b2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 29 Mar 2018 13:56:21 +0200 Subject: [PATCH 09/20] lv_slider: inicator draw bugfix --- lv_objx/lv_bar.c | 4 ++-- lv_objx/lv_slider.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index b76099605..4efe3fdb7 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -286,10 +286,10 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode if(w >= h) { indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); - indic_area.x2 += indic_area.x1; + indic_area.x2 = indic_area.x1 + indic_area.x2 - 1; } else { indic_area.y1 = (int32_t) ((int32_t)h * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); - indic_area.y1 = indic_area.y2 - indic_area.y1; + indic_area.y1 = indic_area.y2 - indic_area.y1 + 1; } /*Draw the indicator*/ diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 0220c3a08..58956e3b2 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -309,11 +309,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig if(slider_w >= slider_h) { area_indic.x2 = (int32_t) ((int32_t)lv_area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value); - area_indic.x2 += area_indic.x1; + area_indic.x2 = area_indic.x1 + area_indic.x2 - 1; } else { area_indic.y1 = (int32_t) ((int32_t)lv_area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value); - area_indic.y1 = area_indic.y2 - area_indic.y1; + area_indic.y1 = area_indic.y2 - area_indic.y1 + 1; } if(cur_value != min_value) lv_draw_rect(&area_indic, mask, style_indic); From 563411a33abc57b811e0bbde7f178376e7aaf982 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 3 Apr 2018 12:21:07 +0200 Subject: [PATCH 10/20] lv_indev: drag test use absolute coosdinates --- lv_core/lv_indev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index acf23aaab..d2b06e6fe 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -655,10 +655,14 @@ static void indev_drag(lv_indev_proc_t * state) lv_coord_t act_y = lv_obj_get_y(drag_obj); uint16_t inv_buf_size = lv_refr_get_buf_size(); /*Get the number of currently invalidated areas*/ + lv_coord_t prev_x = drag_obj->coords.x1; + lv_coord_t prev_y = drag_obj->coords.y1; + lv_obj_set_pos(drag_obj, act_x + state->vect.x, act_y + state->vect.y); /*Set the drag in progress flag if the object is really moved*/ - if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) { + + if(drag_obj->coords.x1 != prev_x || drag_obj->coords.y1 != prev_y) { if(state->drag_range_out != 0) { /*Send the drag begin signal on first move*/ drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); if(state->reset_query != 0) return; From 89452a9d8eb083ff7078a8e05a72fc2d85b429f9 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 3 Apr 2018 12:21:45 +0200 Subject: [PATCH 11/20] lv_cont_set_fit: fix wrong signal paramter --- lv_objx/lv_cont.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index 0f0104f1c..7a3e09be8 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -135,7 +135,9 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en) ext->ver_fit = ver_en == false ? 0 : 1; /*Send a signal to set a new size*/ - cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont); + lv_area_t area; + lv_obj_get_coords(cont, &area); + cont->signal_func(cont, LV_SIGNAL_CORD_CHG, &area); } /*===================== From c2f70d1cc7cadb50a204070ae226264b1fe4a655 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 3 Apr 2018 12:21:59 +0200 Subject: [PATCH 12/20] mono theme: fix typo --- lv_themes/lv_theme_mono.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_themes/lv_theme_mono.c b/lv_themes/lv_theme_mono.c index aedd79b1f..4fc020381 100644 --- a/lv_themes/lv_theme_mono.c +++ b/lv_themes/lv_theme_mono.c @@ -456,7 +456,7 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t *font) * Get a pointer to the theme * @return pointer to the theme */ -lv_theme_t * lv_theme_get_templ(void) +lv_theme_t * lv_theme_get_mono(void) { return &theme; } From eddbbc58b1e65c24409e60192aa1c88ec7f52c1d Mon Sep 17 00:00:00 2001 From: Josh McAtee Date: Wed, 4 Apr 2018 10:24:53 -0700 Subject: [PATCH 13/20] Add missing function definition for lv_group_del --- lv_core/lv_group.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lv_core/lv_group.h b/lv_core/lv_group.h index b7edd9835..34fd967a2 100644 --- a/lv_core/lv_group.h +++ b/lv_core/lv_group.h @@ -61,6 +61,12 @@ typedef struct _lv_group_t */ lv_group_t * lv_group_create(void); +/** + * Delete a group object + * @param group pointer to a group + */ +void lv_group_del(lv_group_t * group) + /** * Add an object to a group * @param group pointer to a group From b047c1318fbc4d7454fd52cbfdcc18628f87a0be Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 5 Apr 2018 22:21:44 +0200 Subject: [PATCH 14/20] minor comment fixes --- lv_core/lv_obj.h | 2 +- lv_objx/lv_img.h | 14 +++++++------- lv_objx/lv_line.h | 6 +++--- lv_objx/lv_lmeter.h | 2 +- lv_objx/lv_page.h | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index 64c2e2b86..3497806bd 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -429,7 +429,7 @@ void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp); * Allocate a new ext. data for an object * @param obj pointer to an object * @param ext_size the size of the new ext. data - * @return Normal pointer to the allocated ext + * @return pointer to the allocated ext */ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size); diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index 5f1154160..aa7f553a1 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -36,8 +36,8 @@ typedef struct /*New data for this type */ const void * src; /*Image source: Pointer to an array or a file or a symbol*/ - lv_coord_t w; /*Width of the image (doubled when upscaled) (Handled by the library)*/ - lv_coord_t h; /*Height of the image (doubled when upscaled) (Handled by the library)*/ + lv_coord_t w; /*Width of the image (Handled by the library)*/ + lv_coord_t h; /*Height of the image (Handled by the library)*/ uint8_t src_type :2; /*See: lv_img_src_t*/ uint8_t auto_size :1; /*1: automatically set the object size to the image size*/ uint8_t chroma_keyed :1; /*1: Chroma keyed image, LV_COLOR_TRANSP (lv_conf.h) pixels will be transparent (Handled by the library)*/ @@ -70,8 +70,8 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img); /** * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0. * Use 'lv_img_set_src()' instead. - * @param img - * @param fn + * @param img - + * @param fn - */ static inline void lv_img_set_file(lv_obj_t * img, const char * fn) { @@ -98,8 +98,8 @@ static inline void lv_img_set_style(lv_obj_t *img, lv_style_t *style) /** * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 - * @param img - * @param upscale + * @param img - + * @param upscale - */ static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale) { @@ -147,7 +147,7 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img) /** * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 - * @param img + * @param img - * @return false */ static inline bool lv_img_get_upscale(lv_obj_t * img) diff --git a/lv_objx/lv_line.h b/lv_objx/lv_line.h index 2fb5b2ddc..252bd5065 100644 --- a/lv_objx/lv_line.h +++ b/lv_objx/lv_line.h @@ -90,8 +90,8 @@ static inline void lv_line_set_style(lv_obj_t *line, lv_style_t *style) /** * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 - * @param line - * @param upscale + * @param line - + * @param upscale - */ static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale) { @@ -127,7 +127,7 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line) /** * Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0 - * @param line + * @param line - * @return false */ static inline bool lv_line_get_upscale(lv_obj_t * line) diff --git a/lv_objx/lv_lmeter.h b/lv_objx/lv_lmeter.h index 65d9899d8..aa8cac3fc 100644 --- a/lv_objx/lv_lmeter.h +++ b/lv_objx/lv_lmeter.h @@ -80,7 +80,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt); * Set the styles of a line meter * @param lmeter pointer to a line meter object * @param bg set the style of the line meter - * */ + */ static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg) { lv_obj_set_style(lmeter, bg); diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index dea8cabe2..2027d8a82 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -160,7 +160,7 @@ static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout) * @param page pointer to a page object * @param type which style should be set * @param style pointer to a style - * */ + */ void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style); /*===================== @@ -229,7 +229,7 @@ static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page) * @param page pointer to page object * @param type which style should be get * @return style pointer to a style - * */ + */ lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type); /*===================== From a4b697f41e6b3f6518c0b284d11d39e3758c8504 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 9 Apr 2018 12:29:56 +0200 Subject: [PATCH 15/20] in style animation add opacity handling to image, text and line --- lv_core/lv_style.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lv_core/lv_style.c b/lv_core/lv_style.c index 162a1370b..e29ad2096 100644 --- a/lv_core/lv_style.c +++ b/lv_core/lv_style.c @@ -272,8 +272,11 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val) STYLE_ATTR_ANIM(body.padding.inner, val); STYLE_ATTR_ANIM(text.line_space, val); STYLE_ATTR_ANIM(text.letter_space, val); + STYLE_ATTR_ANIM(text.opa, val); STYLE_ATTR_ANIM(line.width, val); + STYLE_ATTR_ANIM(line.opa, val); STYLE_ATTR_ANIM(image.intense, val); + STYLE_ATTR_ANIM(image.opa, val); lv_opa_t opa = val == LV_STYLE_ANIM_RES ? LV_OPA_COVER : val; From 94bf21b9be0fc75616bd1390e146c80d647414e1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 9 Apr 2018 12:33:33 +0200 Subject: [PATCH 16/20] lv_fs: fix duplicated error cheching --- lv_misc/lv_fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lv_misc/lv_fs.c b/lv_misc/lv_fs.c index 4b254cf51..bc3375b05 100644 --- a/lv_misc/lv_fs.c +++ b/lv_misc/lv_fs.c @@ -163,7 +163,7 @@ lv_fs_res_t lv_fs_remove (const char * path) lv_fs_res_t lv_fs_read (lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br) { if(br != NULL) *br = 0; - if(file_p->drv == NULL || file_p->drv == NULL) return LV_FS_RES_INV_PARAM; + if(file_p->drv == NULL) return LV_FS_RES_INV_PARAM; if(file_p->drv->read == NULL) return LV_FS_RES_NOT_IMP; uint32_t br_tmp = 0; @@ -185,7 +185,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw, { if(bw != NULL) *bw = 0; - if(file_p->drv == NULL || file_p->drv == NULL) { + if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } @@ -208,7 +208,7 @@ lv_fs_res_t lv_fs_write (lv_fs_file_t * file_p, const void * buf, uint32_t btw, */ lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos) { - if(file_p->drv == NULL || file_p->drv == NULL) { + if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } @@ -229,7 +229,7 @@ lv_fs_res_t lv_fs_seek (lv_fs_file_t * file_p, uint32_t pos) */ lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos) { - if(file_p->drv == NULL || file_p->drv == NULL) { + if(file_p->drv == NULL) { pos = 0; return LV_FS_RES_INV_PARAM; } @@ -252,7 +252,7 @@ lv_fs_res_t lv_fs_tell (lv_fs_file_t * file_p, uint32_t * pos) */ lv_fs_res_t lv_fs_size (lv_fs_file_t * file_p, uint32_t * size) { - if(file_p->drv == NULL || file_p->drv == NULL) { + if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } From 0d385c237aec04947fa0b2e25cc7ac832d11913c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 9 Apr 2018 12:39:58 +0200 Subject: [PATCH 17/20] lv_font: remove const number return values --- lv_core/lv_group.h | 2 +- lv_misc/lv_font.c | 4 ++-- lv_misc/lv_font.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lv_core/lv_group.h b/lv_core/lv_group.h index 34fd967a2..f8ff0dc4e 100644 --- a/lv_core/lv_group.h +++ b/lv_core/lv_group.h @@ -65,7 +65,7 @@ lv_group_t * lv_group_create(void); * Delete a group object * @param group pointer to a group */ -void lv_group_del(lv_group_t * group) +void lv_group_del(lv_group_t * group); /** * Add an object to a group diff --git a/lv_misc/lv_font.c b/lv_misc/lv_font.c index 0745db455..8fedb1132 100644 --- a/lv_misc/lv_font.c +++ b/lv_misc/lv_font.c @@ -292,7 +292,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico * @param unicode_letter an unicode letter which width should be get * @return width of the gylph or -1 if not found */ -const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter) +int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter) { /*Check the range*/ if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) { @@ -309,7 +309,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic * @param unicode_letter an unicode letter which width should be get * @return width of the glyph or -1 if not found */ -const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter) +int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter) { /*Check the range*/ if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) return -1; diff --git a/lv_misc/lv_font.h b/lv_misc/lv_font.h index 107a34b2e..462e38daf 100644 --- a/lv_misc/lv_font.h +++ b/lv_misc/lv_font.h @@ -50,7 +50,7 @@ typedef struct _lv_font_struct const lv_font_glyph_dsc_t * glyph_dsc; const uint32_t * unicode_list; const uint8_t * (*get_bitmap)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's bitmap from a font*/ - const int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/ + int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/ struct _lv_font_struct * next_page; /*Pointer to a font extension*/ uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/ }lv_font_t; @@ -126,7 +126,7 @@ const uint8_t * lv_font_get_bitmap_sparse(const lv_font_t * font, uint32_t unico * @param unicode_letter an unicode letter which width should be get * @return width of the gylph or -1 if not found */ -const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter); +int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unicode_letter); /** * Generic glyph width get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse) @@ -134,7 +134,7 @@ const int16_t lv_font_get_width_continuous(const lv_font_t * font, uint32_t unic * @param unicode_letter an unicode letter which width should be get * @return width of the glyph or -1 if not found */ -const int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter); +int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter); /********************** * MACROS From 913517f19d6f9ef2be6f11a52671c5df5d07ac66 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 13 Apr 2018 20:09:14 +0200 Subject: [PATCH 18/20] lv_kb: before ok/close action don't deassign the lv_ta if there is user defived action --- lv_objx/lv_kb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index 1800ea137..d7254954f 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -387,14 +387,18 @@ static lv_res_t lv_app_kb_action(lv_obj_t * kb, const char * txt) return LV_RES_OK; } else if(strcmp(txt, SYMBOL_CLOSE) == 0) { - lv_kb_set_ta(kb, NULL); /*De-assign the text area*/ if(ext->hide_action) ext->hide_action(kb); - else lv_obj_del(kb); + else { + lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/ + lv_obj_del(kb); + } return LV_RES_INV; } else if(strcmp(txt, SYMBOL_OK) == 0) { - lv_kb_set_ta(kb, NULL); /*De-assign the text area*/ if(ext->ok_action) ext->ok_action(kb); - else lv_obj_del(kb); + else { + lv_kb_set_ta(kb, NULL); /*De-assign the text area to hide it cursor if needed*/ + lv_obj_del(kb); + } return LV_RES_INV; } From 8bc5770c28cd938c1a3fbbcb12556aaeea6df007 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 14 Apr 2018 22:06:13 +0200 Subject: [PATCH 19/20] lv_del_obj: fix if delted while pressed --- lv_core/lv_obj.c | 22 ++++++++++++---------- lv_objx/lv_ta.c | 5 ++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index c7c84e57a..a0bbbf9ae 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -292,17 +292,9 @@ lv_res_t lv_obj_del(lv_obj_t * obj) /* Reset all input devices if * the currently pressed object is deleted*/ lv_indev_t * indev = lv_indev_next(NULL); - lv_obj_t * dpar; while(indev) { - dpar = obj; - while(dpar != NULL) { - if(indev->proc.act_obj == dpar || - indev->proc.last_obj == dpar) { - lv_indev_reset(indev); - break; - } else { - dpar = lv_obj_get_parent(dpar); - } + if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) { + lv_indev_reset(indev); } indev = lv_indev_next(indev); } @@ -1591,6 +1583,16 @@ static void delete_children(lv_obj_t * obj) if(obj->group_p != NULL) lv_group_remove_obj(obj); #endif + /* Reset the input devices if + * the currently pressed object is deleted*/ + lv_indev_t * indev = lv_indev_next(NULL); + while(indev) { + if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) { + lv_indev_reset(indev); + } + indev = lv_indev_next(indev); + } + /*Remove the object from parent's children list*/ lv_obj_t * par = lv_obj_get_parent(obj); lv_ll_rem(&(par->child_ll), obj); diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 931614bb4..86c5ce199 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -1044,7 +1044,10 @@ static void pwd_char_hider(lv_obj_t * ta) int16_t len = lv_txt_get_length(txt); bool refr = false; uint16_t i; - for(i = 0; i < len; i++) txt[i] = '*'; + for(i = 0; i < len; i++) { + txt[i] = '*'; + refr = true; + } txt[i] = '\0'; From 2353ca0621ebd04364e71bfd77d6266c3ce5f61b Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 17 Apr 2018 14:11:26 +0200 Subject: [PATCH 20/20] fix overflow in lv_anim_speed_to_time --- lv_misc/lv_anim.c | 4 +++- lv_misc/lv_anim.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index 9befdc655..53f81b4f2 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -115,7 +115,9 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp) uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end) { int32_t d = LV_MATH_ABS((int32_t) start - end); - uint16_t time = (int32_t)((int32_t)(d * 1000) / speed); + uint32_t time = (int32_t)((int32_t)(d * 1000) / speed); + + if(time > UINT16_MAX) time = UINT16_MAX; if(time == 0) { time++; diff --git a/lv_misc/lv_anim.h b/lv_misc/lv_anim.h index 7144b1920..e69f98ec3 100644 --- a/lv_misc/lv_anim.h +++ b/lv_misc/lv_anim.h @@ -43,7 +43,7 @@ typedef struct _lv_anim_t lv_anim_path_t path; /*An array with the steps of animations*/ int32_t start; /*Start value*/ int32_t end; /*End value*/ - int16_t time; /*Animation time in ms*/ + uint16_t time; /*Animation time in ms*/ int16_t act_time; /*Current time in animation. Set to negative to make delay.*/ uint16_t playback_pause; /*Wait before play back*/ uint16_t repeat_pause; /*Wait before repeat*/