From e72589c6d4c3850a4ce8c79fc77359ce4793a82e Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Fri, 8 Feb 2019 00:03:16 +0200 Subject: [PATCH 01/19] Prevent crash when lv_init is called more than once. After the first call, it will do nothing. --- lv_core/lv_obj.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index a58ead8c2..e527af285 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -49,6 +49,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param); * STATIC VARIABLES **********************/ +static bool _lv_initialized = false; + /********************** * MACROS **********************/ @@ -62,6 +64,9 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param); */ void lv_init(void) { + if (_lv_initialized) return; + _lv_initialized = true; + LV_GC_ROOT(_lv_def_scr) = NULL; LV_GC_ROOT(_lv_act_scr) = NULL; LV_GC_ROOT(_lv_top_layer) = NULL; From 1c67d07dc370d1c30a9417d241548bf57666c482 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 7 Feb 2019 17:57:06 -0500 Subject: [PATCH 02/19] Move setting of _lv_initialized and correct formatting Set _lv_initialized at the end of lv_init. Correct formatting of "if" statement to be consistent with the rest of the library. --- lv_core/lv_obj.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index e527af285..6924ce158 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -64,9 +64,10 @@ static bool _lv_initialized = false; */ void lv_init(void) { - if (_lv_initialized) return; - _lv_initialized = true; - + /* Do nothing if already initialized */ + if (_lv_initialized) + return; + LV_GC_ROOT(_lv_def_scr) = NULL; LV_GC_ROOT(_lv_act_scr) = NULL; LV_GC_ROOT(_lv_top_layer) = NULL; @@ -116,7 +117,7 @@ void lv_init(void) lv_indev_init(); #endif - + _lv_initialized = true; LV_LOG_INFO("lv_init ready"); } From 32017ff6590882c17ada80242ae5a6bb8db418ee Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 8 Feb 2019 10:20:05 -0500 Subject: [PATCH 03/19] Fix x/y mixup in lv_page.c (fixes #815) --- lv_objx/lv_page.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index f01418d10..4058c494a 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -567,7 +567,7 @@ void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist) a.repeat_pause = 0; lv_anim_create(&a); #else - lv_obj_set_y(scrl, lv_obj_get_x(scrl) + dist); + lv_obj_set_y(scrl, lv_obj_get_y(scrl) + dist); #endif } From b7d553796171adf3bf5996236be5b469e3ef2ede Mon Sep 17 00:00:00 2001 From: Folke Will Date: Sat, 9 Feb 2019 13:46:29 +0100 Subject: [PATCH 04/19] Fix color narrowing warning --- lv_misc/lv_color.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lv_misc/lv_color.h b/lv_misc/lv_color.h index 3d2d23157..e386d69f5 100644 --- a/lv_misc/lv_color.h +++ b/lv_misc/lv_color.h @@ -393,14 +393,14 @@ static inline uint8_t lv_color_brightness(lv_color_t color) #endif -#define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \ - ((uint32_t)((uint32_t)c >> 8) & 0xFF), \ - ((uint32_t) c & 0xFF)) +#define LV_COLOR_HEX(c) LV_COLOR_MAKE((uint8_t) ((uint32_t)((uint32_t)c >> 16) & 0xFF), \ + (uint8_t) ((uint32_t)((uint32_t)c >> 8) & 0xFF), \ + (uint8_t) ((uint32_t) c & 0xFF)) /*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/ -#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \ - ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \ - ((uint32_t)(c & 0xF) | ((c & 0xF) << 4))) +#define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \ + (uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \ + (uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4))) static inline lv_color_t lv_color_hex(uint32_t c){ return LV_COLOR_HEX(c); From 321a08b42e22d55ba79da0bfbac027f2bb084ae9 Mon Sep 17 00:00:00 2001 From: Folke Will Date: Sat, 9 Feb 2019 13:48:09 +0100 Subject: [PATCH 05/19] Retain formatting --- lv_misc/lv_color.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lv_misc/lv_color.h b/lv_misc/lv_color.h index e386d69f5..6afdc06b0 100644 --- a/lv_misc/lv_color.h +++ b/lv_misc/lv_color.h @@ -399,8 +399,8 @@ static inline uint8_t lv_color_brightness(lv_color_t color) /*Usage LV_COLOR_HEX3(0x16C) which means LV_COLOR_HEX(0x1166CC)*/ #define LV_COLOR_HEX3(c) LV_COLOR_MAKE((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), \ - (uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \ - (uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4))) + (uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \ + (uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4))) static inline lv_color_t lv_color_hex(uint32_t c){ return LV_COLOR_HEX(c); From ad74d32f5104fbc6f7a13afe98269868272cdc03 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 10 Feb 2019 06:41:51 +0100 Subject: [PATCH 06/19] fix image colors in themes --- lv_themes/lv_theme_alien.c | 3 +++ lv_themes/lv_theme_material.c | 2 ++ lv_themes/lv_theme_night.c | 3 ++- lv_themes/lv_theme_zen.c | 8 +++++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index 7b4ea6026..664f57729 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -615,6 +615,7 @@ static void list_init(void) list_rel.body.border.opa = LV_OPA_COVER; list_rel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); list_rel.text.font = _font; + list_rel.image.color = lv_color_hsv_to_rgb(_hue, 10, 94); lv_style_copy(&list_pr, &list_rel); list_pr.body.empty = 0; @@ -622,6 +623,7 @@ static void list_init(void) list_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 34, 41); list_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 34, 41); list_pr.text.color = lv_color_hsv_to_rgb(_hue, 7, 96); + list_pr.image.color = lv_color_hsv_to_rgb(_hue, 7, 96); lv_style_copy(&list_trel, &list_rel); lv_style_copy(&list_tpr, &list_pr); @@ -787,6 +789,7 @@ static void win_init(void) header.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 80); header.body.border.part = LV_BORDER_BOTTOM; header.text.color = lv_color_hsv_to_rgb(_hue, 5, 100); + header.image.color = lv_color_hsv_to_rgb(_hue, 5, 100); theme.win.bg = &bg; theme.win.sb = &sb; diff --git a/lv_themes/lv_theme_material.c b/lv_themes/lv_theme_material.c index e46c94391..6497d7b4d 100644 --- a/lv_themes/lv_theme_material.c +++ b/lv_themes/lv_theme_material.c @@ -72,6 +72,7 @@ static void basic_init(void) panel.body.padding.ver = LV_DPI / 8; panel.body.padding.inner = LV_DPI / 12; panel.text.color = LV_COLOR_HEX3(0x333); + panel.image.color = LV_COLOR_HEX3(0x333); lv_style_copy(&sb, &def); sb.body.main_color = LV_COLOR_BLACK; @@ -768,6 +769,7 @@ static void win_init(void) pr.body.empty = 0; pr.body.radius = 0; pr.text.color = LV_COLOR_HEX3(0x111); + pr.image.color = LV_COLOR_HEX3(0x111); theme.win.bg = theme.panel; diff --git a/lv_themes/lv_theme_night.c b/lv_themes/lv_theme_night.c index ed3823fdc..6525c3431 100644 --- a/lv_themes/lv_theme_night.c +++ b/lv_themes/lv_theme_night.c @@ -129,8 +129,8 @@ static void btn_init(void) lv_style_copy(&btn_ina, &btn_rel); btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); - btn_ina.text.color = LV_COLOR_HEX3(0xaaa); btn_ina.body.shadow.width = 0; + btn_ina.text.color = LV_COLOR_HEX3(0xaaa); theme.btn.rel = &btn_rel; theme.btn.pr = &btn_pr; @@ -678,6 +678,7 @@ static void win_init(void) win_btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10); win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 10); win_btn_pr.text.color = LV_COLOR_HEX3(0xaaa); + win_btn_pr.image.color = LV_COLOR_HEX3(0xaaa); theme.win.bg = &win_bg; theme.win.sb = &sb; diff --git a/lv_themes/lv_theme_zen.c b/lv_themes/lv_theme_zen.c index 7cdf5a10c..809529c4b 100644 --- a/lv_themes/lv_theme_zen.c +++ b/lv_themes/lv_theme_zen.c @@ -109,8 +109,8 @@ static void btn_init(void) lv_style_copy(&pr, &rel); pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60); - pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60); pr.body.shadow.width = 0; + pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60); lv_style_copy(&tgl_pr, &pr); tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50); @@ -584,18 +584,22 @@ static void list_init(void) rel.body.padding.hor = LV_DPI / 8; rel.body.padding.ver = LV_DPI / 8; rel.text.color = LV_COLOR_HEX3(0x666); + rel.image.color = LV_COLOR_HEX3(0x666); lv_style_copy(&pr, &rel); pr.text.color = theme.btn.pr->text.color; + pr.image.color = theme.btn.pr->image.color; lv_style_copy(&tgl_rel, &rel); tgl_rel.text.color = lv_color_hsv_to_rgb(_hue, 50, 90); lv_style_copy(&tgl_pr, &rel); tgl_pr.text.color = theme.btn.tgl_pr->text.color; + tgl_pr.image.color = theme.btn.tgl_pr->image.color; lv_style_copy(&ina, &rel); ina.text.color = theme.btn.ina->text.color; + ina.image.color = theme.btn.ina->image.color; theme.list.sb = &sb; theme.list.bg = &bg; @@ -732,9 +736,11 @@ static void win_init(void) rel.body.empty = 1; rel.body.border.width = 0; rel.text.color = LV_COLOR_HEX3(0x666); + rel.image.color = LV_COLOR_HEX3(0x666); lv_style_copy(&pr, &rel); pr.text.color = LV_COLOR_HEX3(0x333); + pr.image.color = LV_COLOR_HEX3(0x333); theme.win.bg = theme.panel; theme.win.sb = &sb; From c42f378184fb45d4369a4914199f8bf23e6c2dc8 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 10 Feb 2019 06:51:13 +0100 Subject: [PATCH 07/19] fix image colors in themes --- lv_themes/lv_theme_alien.c | 1 + lv_themes/lv_theme_material.c | 1 + lv_themes/lv_theme_night.c | 1 + lv_themes/lv_theme_zen.c | 2 ++ 4 files changed, 5 insertions(+) diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index 664f57729..22be1dba8 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -114,6 +114,7 @@ static void basic_init(void) panel.body.border.width = 2; panel.body.border.opa = LV_OPA_60; panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); + panel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96); panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70); /*Scrollbar*/ diff --git a/lv_themes/lv_theme_material.c b/lv_themes/lv_theme_material.c index 6497d7b4d..5a780dd1d 100644 --- a/lv_themes/lv_theme_material.c +++ b/lv_themes/lv_theme_material.c @@ -761,6 +761,7 @@ static void win_init(void) header.body.padding.hor = 0; header.body.padding.ver = 0; header.text.color = LV_COLOR_HEX3(0x333); + header.image.color = LV_COLOR_HEX3(0x333); lv_style_copy(&pr, &def); pr.body.main_color = LV_COLOR_HEX3(0xbbb); diff --git a/lv_themes/lv_theme_night.c b/lv_themes/lv_theme_night.c index 6525c3431..937872d84 100644 --- a/lv_themes/lv_theme_night.c +++ b/lv_themes/lv_theme_night.c @@ -59,6 +59,7 @@ static void basic_init(void) bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 30); bg.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); bg.text.font = _font; + bg.image.color = lv_color_hsv_to_rgb(_hue, 5, 95); lv_style_copy(&sb, &def); sb.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 60); diff --git a/lv_themes/lv_theme_zen.c b/lv_themes/lv_theme_zen.c index 809529c4b..d4677943e 100644 --- a/lv_themes/lv_theme_zen.c +++ b/lv_themes/lv_theme_zen.c @@ -52,6 +52,7 @@ static void basic_init(void) def.body.border.opa = LV_OPA_COVER; def.text.font = _font; def.text.color = LV_COLOR_HEX3(0x444); + def.image.color = LV_COLOR_HEX3(0x444); lv_style_copy(&bg, &def); bg.body.main_color = LV_COLOR_WHITE; @@ -731,6 +732,7 @@ static void win_init(void) header.body.border.part = LV_BORDER_BOTTOM; header.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 90); header.text.color = LV_COLOR_HEX3(0x666); + header.image.color = LV_COLOR_HEX3(0x666); lv_style_copy(&rel, &def); rel.body.empty = 1; From d64902b2a5e1b5453f1e9b094f20c533546a0bb3 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sun, 10 Feb 2019 06:52:17 -0500 Subject: [PATCH 08/19] Add note about LV_INDEV_DRAG_THROW to lv_conf_templ.h --- lv_conf_templ.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index fcadf391b..4981e9aa9 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -107,7 +107,7 @@ #define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/ #define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: USE_LV_REAL_DRAW = 1)*/ #define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */ -#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ +#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%] (must be > 0). Greater value means faster slow-down */ #define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ #define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ From f686243f6468fef5e62f7cde8a97deeff8e16598 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sun, 10 Feb 2019 06:53:11 -0500 Subject: [PATCH 09/19] Add warning about LV_INDEV_DRAG_THROW --- lv_core/lv_indev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index 1c2480cce..d3ae93f00 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -20,6 +20,10 @@ * DEFINES *********************/ +#if LV_INDEV_DRAG_THROW <= 0 +#warning "LV_INDEV_DRAG_THROW must be greater than 0" +#endif + /********************** * TYPEDEFS **********************/ From a87f4388e5fb39667737e04eba4db4f425282b1a Mon Sep 17 00:00:00 2001 From: seyyah Date: Mon, 11 Feb 2019 13:25:11 +0300 Subject: [PATCH 10/19] Typo: sonething -> something --- lv_conf_templ.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index 4981e9aa9..b6c7c0e29 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -142,7 +142,7 @@ /*HAL settings*/ #define LV_TICK_CUSTOM 0 /*1: use a custom tick source (removing the need to manually update the tick with `lv_tick_inc`) */ #if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/ +#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ #endif /*LV_TICK_CUSTOM*/ From 6871e0252a4d3239eb907629b259343ce2c1947c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 Feb 2019 05:39:44 +0100 Subject: [PATCH 11/19] add LV_ATTRIBUTE_MEM_ALIGN option update lv_conf_chechker.h --- lv_conf_checker.h | 18 +++++++++++------- lv_conf_templ.h | 1 + lv_core/lv_vdb.c | 10 +++++++--- lv_draw/lv_draw_vbasic.c | 21 +++++---------------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lv_conf_checker.h b/lv_conf_checker.h index e4caa9480..8751c74e9 100644 --- a/lv_conf_checker.h +++ b/lv_conf_checker.h @@ -40,7 +40,8 @@ #endif #endif /*LV_MEM_CUSTOM*/ -/* Garbage Collector settings. */ +/* Garbage Collector settings + * Used if lvgl is binded to higher language and the memory is managed by that language */ #ifndef LV_ENABLE_GC #define LV_ENABLE_GC 0 #endif @@ -89,7 +90,7 @@ *----------------*/ /* VDB (Virtual Display Buffer) is an internal graphics buffer. - * To images will be drawn into this buffer first and then + * The GUI will be drawn into this buffer first and then * the buffer will be passed to your `disp_drv.disp_flush` function to * copy it to your frame buffer. * VDB is required for: buffered drawing, opacity, anti-aliasing and shadows @@ -115,7 +116,7 @@ #define LV_VDB_ADR 0 #endif -/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional) +/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing * The flushing should use DMA to write the frame buffer in the background */ #ifndef LV_VDB_DOUBLE #define LV_VDB_DOUBLE 0 @@ -165,7 +166,7 @@ /*Color settings*/ #ifndef LV_COLOR_DEPTH -#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/32*/ +#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/ #endif #ifndef LV_COLOR_16_SWAP #define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/ @@ -224,6 +225,9 @@ #ifndef LV_ATTRIBUTE_TASK_HANDLER #define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ #endif +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/ +#endif #ifndef LV_COMPILER_VLA_SUPPORTED #define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ #endif @@ -237,7 +241,7 @@ #endif #if LV_TICK_CUSTOM == 1 #ifndef LV_TICK_CUSTOM_INCLUDE -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/ +#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/ #endif #ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ @@ -262,7 +266,7 @@ /* 1: Print the log with 'printf'; 0: user need to register a callback*/ #ifndef LV_LOG_PRINTF -# define LV_LOG_PRINTF 1 +# define LV_LOG_PRINTF 0 #endif #endif /*USE_LV_LOG*/ @@ -386,7 +390,7 @@ #define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/ #endif #ifndef LV_OBJ_REALIGN -#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ #endif /*================== diff --git a/lv_conf_templ.h b/lv_conf_templ.h index b6c7c0e29..f946864b2 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -136,6 +136,7 @@ /*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_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/ #define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ #define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */ diff --git a/lv_core/lv_vdb.c b/lv_core/lv_vdb.c index c50eb99ab..38aae34f4 100644 --- a/lv_core/lv_vdb.c +++ b/lv_core/lv_vdb.c @@ -20,6 +20,10 @@ #define LV_ATTRIBUTE_FLUSH_READY #endif +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + /********************** * TYPEDEFS **********************/ @@ -36,7 +40,7 @@ #if LV_VDB_DOUBLE == 0 # if LV_VDB_ADR == 0 /*If the buffer address is not specified simply allocate it*/ -static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES]; static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf}; # else /*LV_VDB_ADR != 0*/ /*If the buffer address is specified use that address*/ @@ -49,8 +53,8 @@ static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR}; static uint8_t vdb_active = 0; # if LV_VDB_ADR == 0 /*If the buffer address is not specified simply allocate it*/ -static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES]; -static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES]; static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}}; # else /*LV_VDB_ADR != 0*/ /*If the buffer address is specified use that address*/ diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index c8b2fab55..4d1506d9a 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -30,6 +30,10 @@ *********************/ #define VFILL_HW_ACC_SIZE_LIMIT 50 /*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/ +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + /********************** * TYPEDEFS **********************/ @@ -147,7 +151,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, #if USE_LV_GPU - static lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/ + static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/ static lv_coord_t last_width = -1; lv_coord_t w = lv_area_get_width(&vdb_rel_a); @@ -529,21 +533,6 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); #else vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].alpha, px_color, opa_result); -// if(vdb_buf_tmp[col].alpha == LV_OPA_TRANSP) { -// /* When it is the first visible pixel on the transparent screen -// * simlply use this color and set the pixel opa as backrounds alpha*/ -// vdb_buf_tmp[col] = px_color; -// vdb_buf_tmp[col].alpha = opa_result; -// } else { -// /* If already this pixel is already written then for performance reasons -// * don't care with alpha channel -// */ -// lv_opa_t bg_opa = vdb_buf_tmp[col].alpha; -// vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); -// -// uint16_t opa_tmp = (uint16_t)opa_result + ((bg_opa * (255 - opa_result)) >> 8); -// vdb_buf_tmp[col].alpha = opa_tmp > 0xFF ? 0xFF : opa_tmp ; -// } #endif } } From c71047f35975b293362320406c6104b8edcf2b73 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 Feb 2019 06:03:06 +0100 Subject: [PATCH 12/19] lv_chart: LV_CHART_VETICAL_LINES fixes --- lv_objx/lv_chart.c | 55 ++++++++++++++++++---------------------------- lv_objx/lv_chart.h | 8 +++---- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index 1dedaa7a4..3bd6f5304 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -764,12 +764,18 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask) */ static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mask) { + lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + lv_coord_t w = lv_obj_get_width(chart); + /*Vertical lines works only if the width == point count. Else use the normal line type*/ + if(ext->point_cnt != w) { + lv_chart_draw_lines(chart, mask); + return; + } uint16_t i; lv_point_t p1; lv_point_t p2; - lv_coord_t w = lv_obj_get_width(chart); lv_coord_t h = lv_obj_get_height(chart); lv_coord_t x_ofs = chart->coords.x1; lv_coord_t y_ofs = chart->coords.y1; @@ -789,47 +795,28 @@ static void lv_chart_draw_vertical_lines(lv_obj_t * chart, const lv_area_t * mas p2.x = 0 + x_ofs; y_tmp = (int32_t)((int32_t) ser->points[0] - ext->ymin) * h; y_tmp = y_tmp / (ext->ymax - ext->ymin); - p1.y = LV_COORD_MIN; p2.y = h - y_tmp + y_ofs; + p1.y = p2.y; - if(ext->point_cnt == w) + for(i = 0; i < ext->point_cnt; i++) { - for(i = 0; i < ext->point_cnt; i++) + + y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h; + y_tmp = y_tmp / (ext->ymax - ext->ymin); + p2.y = h - y_tmp + y_ofs; + + if(p1.y == p2.y) { + p2.x++; + } - y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h; - y_tmp = y_tmp / (ext->ymax - ext->ymin); - p2.y = h - y_tmp + y_ofs; - - if(p1.y == p2.y) - { - p2.x++; - } - + if(ser->points[i] != LV_CHART_POINT_DEF) { lv_draw_line(&p1, &p2, mask, &style, opa_scale); - - p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs; - p1.x = p2.x; - p1.y = p2.y; } - } - else - { - for(i = 1; i < ext->point_cnt; i ++) { - p1.x = p2.x; - p1.y = p2.y; - p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs; - - y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h; - y_tmp = y_tmp / (ext->ymax - ext->ymin); - p2.y = h - y_tmp + y_ofs; - - if(ser->points[i - 1] >= 0 && ser->points[i] >= 0) - { - lv_draw_line(&p1, &p2, mask, &style, opa_scale); - } - } + p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs; + p1.x = p2.x; + p1.y = p2.y; } } } diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index 08d4c4eea..baea9d0f4 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -62,10 +62,10 @@ typedef struct /*Chart types*/ enum { - LV_CHART_TYPE_LINE = 0x01, - LV_CHART_TYPE_COLUMN = 0x02, - LV_CHART_TYPE_POINT = 0x04, - LV_CHART_TYPE_VERTICAL_LINE = 0x08, + LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/ + LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/ + LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/ + LV_CHART_TYPE_VERTICAL_LINE = 0x08, /*Draw vertical lines on points (useful when chart width == point count)*/ }; typedef uint8_t lv_chart_type_t; From 6f47dd6522c9c5db660feb03904000c05b5b1df2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 Feb 2019 07:33:42 +0100 Subject: [PATCH 13/19] theme fixes --- lv_themes/lv_theme_alien.c | 4 ++++ lv_themes/lv_theme_material.c | 2 ++ lv_themes/lv_theme_night.c | 4 ++++ lv_themes/lv_theme_zen.c | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index 22be1dba8..a928df1fc 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -157,6 +157,7 @@ static void btn_init(void) btn_rel.body.padding.inner = LV_DPI / 10; btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); btn_rel.text.font = _font; + btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96); lv_style_copy(&btn_pr, &btn_rel); btn_pr.body.opa = LV_OPA_COVER; @@ -166,6 +167,7 @@ static void btn_init(void) btn_pr.body.border.opa = LV_OPA_60; btn_pr.text.font = _font; btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100); + btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 10, 100); lv_style_copy(&btn_trel, &btn_pr); btn_trel.body.opa = LV_OPA_COVER; @@ -176,6 +178,7 @@ static void btn_init(void) btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90); btn_trel.text.font = _font; btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100); + btn_trel.image.color = lv_color_hsv_to_rgb(_hue, 0, 100); lv_style_copy(&btn_tpr, &btn_trel); btn_tpr.body.opa = LV_OPA_COVER; @@ -186,6 +189,7 @@ static void btn_init(void) btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70); btn_tpr.text.font = _font; btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); + btn_tpr.image.color = lv_color_hsv_to_rgb(_hue, 10, 90); lv_style_copy(&btn_ina, &btn_rel); btn_ina.body.border.opa = LV_OPA_60; diff --git a/lv_themes/lv_theme_material.c b/lv_themes/lv_theme_material.c index 5a780dd1d..01e4791e4 100644 --- a/lv_themes/lv_theme_material.c +++ b/lv_themes/lv_theme_material.c @@ -110,6 +110,7 @@ static void btn_init(void) rel.body.shadow.type = LV_SHADOW_BOTTOM; rel.body.shadow.width = 6; rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 95); + rel.image.color = lv_color_hsv_to_rgb(_hue, 5, 95); lv_style_copy(&pr, &rel); @@ -132,6 +133,7 @@ static void btn_init(void) ina.body.grad_color = ina.body.main_color; ina.body.shadow.width = 0; ina.text.color = lv_color_hsv_to_rgb(_hue, 95, 5); + ina.image.color = lv_color_hsv_to_rgb(_hue, 95, 5); theme.btn.rel = &rel; theme.btn.pr = ≺ diff --git a/lv_themes/lv_theme_night.c b/lv_themes/lv_theme_night.c index 937872d84..ec78a4fe0 100644 --- a/lv_themes/lv_theme_night.c +++ b/lv_themes/lv_theme_night.c @@ -110,6 +110,7 @@ static void btn_init(void) btn_rel.body.shadow.color = LV_COLOR_HEX3(0x111); btn_rel.body.shadow.width = LV_DPI / 30; btn_rel.text.color = LV_COLOR_HEX3(0xeee); + btn_rel.image.color = LV_COLOR_HEX3(0xeee); lv_style_copy(&btn_pr, &btn_rel); btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 30); @@ -120,18 +121,21 @@ static void btn_init(void) btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40); btn_tgl_rel.body.shadow.width = LV_DPI / 40; btn_tgl_rel.text.color = LV_COLOR_HEX3(0xddd); + btn_tgl_rel.image.color = LV_COLOR_HEX3(0xddd); lv_style_copy(&btn_tgl_pr, &btn_rel); btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 10); btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 30); btn_tgl_pr.body.shadow.width = LV_DPI / 30; btn_tgl_pr.text.color = LV_COLOR_HEX3(0xddd); + btn_tgl_pr.image.color = LV_COLOR_HEX3(0xddd); lv_style_copy(&btn_ina, &btn_rel); btn_ina.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_ina.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_ina.body.shadow.width = 0; btn_ina.text.color = LV_COLOR_HEX3(0xaaa); + btn_ina.image.color = LV_COLOR_HEX3(0xaaa); theme.btn.rel = &btn_rel; theme.btn.pr = &btn_pr; diff --git a/lv_themes/lv_theme_zen.c b/lv_themes/lv_theme_zen.c index d4677943e..4c87e9073 100644 --- a/lv_themes/lv_theme_zen.c +++ b/lv_themes/lv_theme_zen.c @@ -107,19 +107,23 @@ static void btn_init(void) rel.body.padding.hor = LV_DPI / 4; rel.body.padding.ver = LV_DPI / 8; rel.text.color = lv_color_hsv_to_rgb(_hue, 40, 90); + rel.image.color = lv_color_hsv_to_rgb(_hue, 40, 90); lv_style_copy(&pr, &rel); pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 60); pr.body.shadow.width = 0; pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 60); + pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 60); lv_style_copy(&tgl_pr, &pr); tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 40, 50); tgl_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 50); + tgl_pr.image.color = lv_color_hsv_to_rgb(_hue, 40, 50); lv_style_copy(&ina, &tgl_pr); ina.body.border.color = LV_COLOR_HEX3(0xbbb); ina.text.color = LV_COLOR_HEX3(0xbbb); + ina.image.color = LV_COLOR_HEX3(0xbbb); theme.btn.rel = &rel; theme.btn.pr = ≺ From caa2064c90d2b6938133466c3d55ac62fc613624 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 Feb 2019 07:55:46 +0100 Subject: [PATCH 14/19] lv_spinbox: fixes --- lv_objx/lv_spinbox.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lv_objx/lv_spinbox.c b/lv_objx/lv_spinbox.c index dc4c6086b..13e19de7a 100644 --- a/lv_objx/lv_spinbox.c +++ b/lv_objx/lv_spinbox.c @@ -67,16 +67,15 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) ext->ta.accapted_chars = "1234567890+-."; ext->value = 0; - ext->dec_point_pos = 2; + ext->dec_point_pos = 0; ext->digit_count = 5; - ext->step = 100; + ext->digit_padding_left = 0; + ext->step = 1; ext->range_max = 99999; ext->range_min = -99999; ext->value_changed_cb = NULL; lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK | LV_CURSOR_HIDDEN); /*hidden by default*/ - lv_ta_set_cursor_pos(new_spinbox, 4); - /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_func(new_spinbox, lv_spinbox_signal); @@ -450,8 +449,8 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox) int i = 0; uint8_t digits[16]; - if(v < 0) - v = -v; + if(v < 0) v = -v; + for(i = 0; i < dc; i++) { digits[i] = v%10; @@ -464,18 +463,24 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox) ext->digits[1 + pl + k] = '0' + digits[--i]; } - ext->digits[1 + pl + intDigits] = '.'; + if(ext->dec_point_pos != 0) { + ext->digits[1 + pl + intDigits] = '.'; - int d; + int d; + + for(d = 0; d < decDigits; d++) + { + ext->digits[1 + pl + intDigits + 1 + d] = '0' + digits[--i]; + } + + ext->digits[1 + pl + intDigits + 1 + decDigits] = '\0'; + } else { + ext->digits[1 + pl + intDigits] = '\0'; - for(d = 0; d < decDigits; d++) - { - ext->digits[1 + pl + intDigits + 1 + d] = '0' + digits[--i]; } - ext->digits[1 + pl + intDigits + 1 + decDigits] = '\0'; - lv_label_set_text(ext->ta.label, (char*)ext->digits); + lv_ta_set_text(spinbox, (char*)ext->digits); int32_t step = ext->step; uint8_t cPos = ext->digit_count + pl; From 44c239780479017179e16371a97fab84ceb5b2b2 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 12 Feb 2019 07:01:04 -0500 Subject: [PATCH 15/19] Add LV_INDEV_DRAG_THROW checker to lv_conf_templ.h --- lv_conf_templ.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index f946864b2..a4712fea6 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -382,6 +382,13 @@ /************************* * Non-user section *************************/ + +#if LV_INDEV_DRAG_THROW <= 0 +#warning "LV_INDEV_DRAG_THROW must be greater than 0" +#undef LV_INDEV_DRAG_THROW +#define LV_INDEV_DRAG_THROW 1 +#endif + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ # define _CRT_SECURE_NO_WARNINGS #endif From 9ac933fb9e59acf90e73581d008955f466fbf800 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 12 Feb 2019 07:04:34 -0500 Subject: [PATCH 16/19] Fix image source not being copied in lv_imgbtn --- lv_objx/lv_imgbtn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_objx/lv_imgbtn.c b/lv_objx/lv_imgbtn.c index 75e545343..abae278f3 100644 --- a/lv_objx/lv_imgbtn.c +++ b/lv_objx/lv_imgbtn.c @@ -82,7 +82,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy) /*Copy an existing image button*/ else { #if LV_IMGBTN_TILED == 0 - memset(ext->img_src, 0, sizeof(ext->img_src)); + memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src)); #else lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy); From fabd551e2ad3171383ecfdae740900da3c588e1b Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 12 Feb 2019 11:03:34 -0500 Subject: [PATCH 17/19] Fix error reported by @canardos in lv_imgbtn --- lv_objx/lv_imgbtn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lv_objx/lv_imgbtn.c b/lv_objx/lv_imgbtn.c index abae278f3..3f97d5d67 100644 --- a/lv_objx/lv_imgbtn.c +++ b/lv_objx/lv_imgbtn.c @@ -81,11 +81,10 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy) } /*Copy an existing image button*/ else { + lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy); #if LV_IMGBTN_TILED == 0 memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src)); #else - lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy); - memcpy(ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left)); memcpy(ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid)); memcpy(ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right)); From f5b8dd17b81eebae6fdd53dd581e2f5075c7e08f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 12 Feb 2019 22:48:39 +0100 Subject: [PATCH 18/19] lv_list_set_selected_btn fix --- lv_objx/lv_list.c | 5 +++-- lv_objx/lv_list.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 8accb665a..48763d663 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -300,6 +300,7 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn) } ext->selected_btn = btn; + ext->last_sel = btn; if(ext->selected_btn) { lv_btn_state_t s = lv_btn_get_state(ext->selected_btn); @@ -760,7 +761,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_group_t * g = lv_obj_get_group(list); if(lv_group_get_editing(g)) { lv_list_ext_t * ext = lv_obj_get_ext_attr(list); - if(NULL != ext->last_sel) { + if(ext->last_sel) { /* Select the last used button */ lv_list_set_btn_selected(list, ext->last_sel); } @@ -779,7 +780,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_list_set_btn_selected(list, last_clicked_btn); } else { lv_list_ext_t * ext = lv_obj_get_ext_attr(list); - if(NULL != ext->last_sel) { + if(ext->last_sel) { /* Select the last used button */ lv_list_set_btn_selected(list, ext->last_sel); } diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 0fe0c1291..a31877082 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -59,8 +59,8 @@ typedef struct uint32_t size; /*the number of items(buttons) in the list*/ bool single_mode; /* whether single selected mode is enabled */ #if USE_LV_GROUP - lv_obj_t * last_sel; /* Last btn selected */ - lv_obj_t * selected_btn; + lv_obj_t * last_sel; /* The last selected button. It will be reverted when the list is focused again */ + lv_obj_t * selected_btn; /* The button is currently being selected*/ #endif } lv_list_ext_t; From 92babea8c8bf496681071491f14717b535217556 Mon Sep 17 00:00:00 2001 From: manison Date: Tue, 12 Feb 2019 16:41:26 +0100 Subject: [PATCH 19/19] fix typo in function name --- lv_core/lv_obj.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 6924ce158..47ec93e18 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -38,9 +38,9 @@ /********************** * STATIC PROTOTYPES **********************/ -static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff); +static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff); static void report_style_mod_core(void * style_p, lv_obj_t * obj); -static void refresh_childen_style(lv_obj_t * obj); +static void refresh_children_style(lv_obj_t * obj); static void delete_children(lv_obj_t * obj); static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode); static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param); @@ -551,7 +551,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) obj->coords.x2 += diff.x; obj->coords.y2 += diff.y; - refresh_childen_position(obj, diff.x, diff.y); + refresh_children_position(obj, diff.x, diff.y); /*Inform the object about its new coordinates*/ obj->signal_func(obj, LV_SIGNAL_CORD_CHG, &ori); @@ -987,7 +987,7 @@ void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style) obj->style_p = style; /*Send a signal about style change to every children with NULL style*/ - refresh_childen_style(obj); + refresh_children_style(obj); /*Notify the object about the style change too*/ lv_obj_refresh_style(obj); @@ -1872,7 +1872,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) * @param x_diff x coordinate shift * @param y_diff y coordinate shift */ -static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff) +static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff) { lv_obj_t * i; LL_READ(obj->child_ll, i) { @@ -1881,7 +1881,7 @@ static void refresh_childen_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord i->coords.x2 += x_diff; i->coords.y2 += y_diff; - refresh_childen_position(i, x_diff, y_diff); + refresh_children_position(i, x_diff, y_diff); } } @@ -1895,7 +1895,7 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj) lv_obj_t * i; LL_READ(obj->child_ll, i) { if(i->style_p == style_p || style_p == NULL) { - refresh_childen_style(i); + refresh_children_style(i); lv_obj_refresh_style(i); } @@ -1908,16 +1908,16 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj) * because the NULL styles are inherited from the parent * @param obj pointer to an object */ -static void refresh_childen_style(lv_obj_t * obj) +static void refresh_children_style(lv_obj_t * obj) { lv_obj_t * child = lv_obj_get_child(obj, NULL); while(child != NULL) { if(child->style_p == NULL) { - refresh_childen_style(child); /*Check children too*/ + refresh_children_style(child); /*Check children too*/ lv_obj_refresh_style(child); /*Notify the child about the style change*/ } else if(child->style_p->glass) { /*Children with 'glass' parent might be effected if their style == NULL*/ - refresh_childen_style(child); + refresh_children_style(child); } child = lv_obj_get_child(obj, child); }