From 779cac9b7747bf062df42a0195f6fbbd9c1a0b2f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 14:42:41 +0100 Subject: [PATCH 01/23] Update TODO_PATCH.md --- docs/TODO_PATCH.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/TODO_PATCH.md b/docs/TODO_PATCH.md index 309915f72..d80ffd913 100644 --- a/docs/TODO_PATCH.md +++ b/docs/TODO_PATCH.md @@ -8,6 +8,9 @@ Please create an issue to introduce a bug instead of adding pull request to this ## v5.1.1 (in progress) - [ ] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates +- [ ] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED +- [ ] lv_group_create: init focus_cb +- [ ] fix of 16 bit image drawing with alpha bytes ## v5.0.3 (released on: 09.03.2018) - [x] lv_chart: Fix the use of point_num more then 256 (Thanks to upbeat27) From 9b2de5f215bba290a811a06dc9df084ba7936c23 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 22 Mar 2018 14:42:56 +0100 Subject: [PATCH 02/23] Update TODO_PATCH.md --- docs/TODO_PATCH.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/TODO_PATCH.md b/docs/TODO_PATCH.md index d80ffd913..90563e580 100644 --- a/docs/TODO_PATCH.md +++ b/docs/TODO_PATCH.md @@ -7,10 +7,10 @@ The bugfixes of the still not released version are in `beta` branche. Please create an issue to introduce a bug instead of adding pull request to this file. ## v5.1.1 (in progress) -- [ ] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates -- [ ] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED -- [ ] lv_group_create: init focus_cb -- [ ] fix of 16 bit image drawing with alpha bytes +- [x] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates +- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED +- [x] lv_group_create: init focus_cb +- [x] fix of 16 bit image drawing with alpha bytes ## v5.0.3 (released on: 09.03.2018) - [x] lv_chart: Fix the use of point_num more then 256 (Thanks to upbeat27) From 908db3cd5907fe9595f2c5c67a97273376493f7d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 4 Apr 2018 00:17:37 +0200 Subject: [PATCH 03/23] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index a1af01bf8..b79352759 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -46,10 +46,13 @@ If you faced with **something more clomplex** like: * affects a whole file, module or even the architecture * needs deeper discussion -then please tell -* what do you experience -* what do you expect to happen -* how to reproduce the issue (maybe with an example code) +then please +* tell what do you experience +* tell what do you expect to happen +* tell how to reproduce the issue +* provide a simlified code example (better if can be tested with copy-paste) +* attache your lv_conf.h (if you feel it's important) +* logs and long codes should be attached in a file (instead of copying into a comment) ## How to suggest a feature? If you have a good and useful idea open issue to tell it! Please note the followings on suggesting new features: From aac716d4973bc307e1c0d2b64202fad3e6230973 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 18 Apr 2018 13:23:19 +0200 Subject: [PATCH 04/23] lv_task: lv_task_set_prio fix --- lv_misc/lv_ll.c | 26 ++++++++++++++++++++++++ lv_misc/lv_ll.h | 8 ++++++++ lv_misc/lv_task.c | 51 +++++++++++++++++++++++++++++------------------ 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/lv_misc/lv_ll.c b/lv_misc/lv_ll.c index de2ff52db..e829530a2 100644 --- a/lv_misc/lv_ll.c +++ b/lv_misc/lv_ll.c @@ -306,6 +306,32 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p) /*TODO*/ } +/** + * Move a nodw before an other node in the same linked list + * @param ll_p pointer to a linked list + * @param n_act pointer to node to move + * @param n_after pointer to a node which should be after `n_act` + */ +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*/ + + if(n_after == NULL) { + void * n_before = lv_ll_get_tail(ll_p); + node_set_next(ll_p, n_before, n_act); + node_set_prev(ll_p, n_act, n_before); + node_set_next(ll_p, n_act, NULL); + ll_p->tail = n_act; + } else { + void * n_before = lv_ll_get_prev(ll_p, n_after); + /*Move the node between `n_before` and `n_after`*/ + node_set_next(ll_p, n_before, n_act); + node_set_prev(ll_p, n_act, n_before); + node_set_prev(ll_p, n_after, n_act); + node_set_next(ll_p, n_act, n_after); + } +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/lv_misc/lv_ll.h b/lv_misc/lv_ll.h index 2c6096f85..637b67261 100644 --- a/lv_misc/lv_ll.h +++ b/lv_misc/lv_ll.h @@ -122,6 +122,14 @@ void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act); */ void * lv_ll_get_prev(lv_ll_t * ll_p, void * n_act); +/** + * Move a nodw before an other node in the same linked list + * @param ll_p pointer to a linked list + * @param n_act pointer to node to move + * @param n_after pointer to a node which should be after `n_act` + */ +void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); + /********************** * MACROS **********************/ diff --git a/lv_misc/lv_task.c b/lv_misc/lv_task.c index 246fba633..feccfe06e 100644 --- a/lv_misc/lv_task.c +++ b/lv_misc/lv_task.c @@ -69,27 +69,32 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) * If a lower priority task is executed check task again from the highest priority * but on the priority of executed tasks don't run tasks before the executed*/ lv_task_t * task_interruper = NULL; - lv_task_t * tmp; + lv_task_t * next; bool end_flag; do { end_flag = true; - LL_READ(lv_task_ll,tmp){ + lv_task_t * act = lv_ll_get_head(&lv_task_ll); + while(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); /*Here is the interrupter task. Don't execute it again.*/ - if(tmp == task_interruper) { + if(act == task_interruper) { task_interruper = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/ - continue; + act = next; + continue; /*Load the next task*/ } /*Just try to run the tasks with highest priority.*/ - if(tmp->prio == LV_TASK_PRIO_HIGHEST) { - lv_task_exec(tmp); + if(act->prio == LV_TASK_PRIO_HIGHEST) { + lv_task_exec(act); } /*Tasks with higher priority then the interrupted shall be run in every case*/ else if(task_interruper) { - if(tmp->prio > task_interruper->prio) { - if(lv_task_exec(tmp)) { - task_interruper = tmp; /*Check all tasks again from the highest priority */ + if(act->prio > task_interruper->prio) { + if(lv_task_exec(act)) { + task_interruper = act; /*Check all tasks again from the highest priority */ end_flag = false; break; } @@ -98,12 +103,13 @@ 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(tmp)) { - task_interruper = tmp; /*Check all tasks again from the highest priority */ + if(lv_task_exec(act)) { + task_interruper = act; /*Check all tasks again from the highest priority */ end_flag = false; break; } } + act = next; /*Load the next task*/ } } while(!end_flag); @@ -183,15 +189,22 @@ void lv_task_del(lv_task_t* lv_task_p) */ void lv_task_set_prio(lv_task_t* lv_task_p, lv_task_prio_t prio) { - /*It's easier to create a new task with the new priority rather then modify the linked list*/ - lv_task_t * new_task = lv_task_create(lv_task_p->task, lv_task_p->period, prio, lv_task_p->param); - lv_mem_assert(new_task); - new_task->once = lv_task_p->once; - new_task->last_run = lv_task_p->last_run; + /*Find the tasks with new priority*/ + lv_task_t * i; + LL_READ(lv_task_ll, i) { + if(i->prio <= prio) { + if(i != lv_task_p) lv_ll_move_before(&lv_task_ll, lv_task_p, i); + break; + } + } - /*Delete the old task*/ - lv_ll_rem(&lv_task_ll, lv_task_p); - lv_mem_free(lv_task_p); + /*There was no such a low priority so far then add the node to the tail*/ + if(i == NULL) { + lv_ll_move_before(&lv_task_ll, lv_task_p, NULL); + } + + + lv_task_p->prio = prio; } /** From 51e15ced3f79b3ef0b962f0a0a9652037bb279f0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 18 Apr 2018 18:11:20 +0200 Subject: [PATCH 05/23] add lv_theme_zen.h to lv_theme.h --- lv_themes/lv_theme.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lv_themes/lv_theme.h b/lv_themes/lv_theme.h index ed05a41a2..22e7b2439 100644 --- a/lv_themes/lv_theme.h +++ b/lv_themes/lv_theme.h @@ -258,6 +258,7 @@ lv_theme_t * lv_theme_get_current(void); #include "lv_theme_default.h" #include "lv_theme_alien.h" #include "lv_theme_night.h" +#include "lv_theme_zen.h" #include "lv_theme_mono.h" #ifdef __cplusplus From ee3a44388c5e19d744122505f943340240becb84 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 8 May 2018 11:20:55 +0200 Subject: [PATCH 06/23] lv_draw: shadow draw fix array over indexing --- lv_draw/lv_draw.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 186d82edf..ea1625dfe 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -29,7 +29,7 @@ #define LABEL_RECOLOR_PAR_LENGTH 6 -#define SHADOW_OPA_EXTRA_PRECISION 8 /*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/ +#define SHADOW_OPA_EXTRA_PRECISION 0 /*Calculate with 2^x bigger shadow opacity values to avoid rounding errors*/ #define SHADOW_BOTTOM_AA_EXTRA_RADIUS 3 /*Add extra radius with LV_SHADOW_BOTTOM to cover anti-aliased corners*/ /********************** * TYPEDEFS @@ -1789,7 +1789,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask bool line_ready; for(line = 1; line <= radius + swidth; line++) { /*Check all rows and make the 1D blur to 2D*/ line_ready = false; - for(col = 1; col < radius + swidth + 10; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/ + for(col = 1; col < radius + swidth; col++) { /*Check all pixels in a 1D blur line (from the origo to last shadow pixel (radius + swidth))*/ /*Sum the opacities from the lines above and below this 'row'*/ int16_t line_rel; @@ -1806,7 +1806,7 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask } /*Add the value of the 1D blur on 'col_rel' position*/ - if(col_rel < -swidth) { /*Outside of the burred area. */ + if(col_rel < -swidth) { /*Outside of the blurred area. */ if(line_rel == -swidth) line_ready = true; /*If no data even on the very first line then it wont't be anything else in this line*/ break; /*Break anyway because only smaller 'col_rel' values will come */ } @@ -1815,7 +1815,10 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask } line_2d_blur[col] = px_opa_sum >> SHADOW_OPA_EXTRA_PRECISION; - if(line_ready) break; + if(line_ready) { + col++; /*To make this line to the last one ( drawing will go to '< col')*/ + break; + } } @@ -1833,12 +1836,14 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask point_lb.y = ofs_lb.y + line; uint16_t d; - for(d = 1; d <= col; d++) { + for(d = 1; d < col; d++) { if(point_rt.x != point_lt.x) { px_fp(point_lt.x,point_lt.y , mask, style->body.shadow.color, line_2d_blur[d]); } + printf("%d, ", line_2d_blur[d]); + if(point_rb.x != point_lb.x && point_lt.y != point_lb.y) { px_fp(point_lb.x,point_lb.y , mask, style->body.shadow.color, line_2d_blur[d]); } @@ -1857,6 +1862,8 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask point_lt.x--; } + printf("\n"); + /* Put the first line to the edges too. * It is not correct because blur should be done below the corner too * but is is simple, fast and gives a good enough result*/ From 68d262ba931996c88bbcfbe98ad38dc3bea1647f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 8 May 2018 11:22:21 +0200 Subject: [PATCH 07/23] lv_draw: remove debug printf-s --- lv_draw/lv_draw.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index ea1625dfe..482c74b7b 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -1842,8 +1842,6 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask px_fp(point_lt.x,point_lt.y , mask, style->body.shadow.color, line_2d_blur[d]); } - printf("%d, ", line_2d_blur[d]); - if(point_rb.x != point_lb.x && point_lt.y != point_lb.y) { px_fp(point_lb.x,point_lb.y , mask, style->body.shadow.color, line_2d_blur[d]); } @@ -1862,8 +1860,6 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask point_lt.x--; } - printf("\n"); - /* Put the first line to the edges too. * It is not correct because blur should be done below the corner too * but is is simple, fast and gives a good enough result*/ From 89b5907eb6bf086909cf81858ae541a9b76773ea Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 8 May 2018 11:28:07 +0200 Subject: [PATCH 08/23] lv_slider: draw greater background on negative padding if knob_in == 1 --- lv_objx/lv_slider.c | 20 +++++++++++++++----- lv_themes/lv_theme_alien.c | 4 ++-- lv_themes/lv_theme_zen.c | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 58956e3b2..e115e54e0 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -273,11 +273,21 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig pad_hor_bg = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1; } - /*Let space only in the perpendicular directions*/ - area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/ - area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/ - area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/ - area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/ + if(ext->knob_in) { /*Enable extra size if the knob is inside */ + if(pad_hor_bg < 0) { + area_bg.x1 += pad_hor_bg; + area_bg.x2 -= pad_hor_bg; + } + if(pad_ver_bg < 0) { + area_bg.y1 += pad_hor_bg; + area_bg.y2 -= pad_hor_bg; + } + } else { /*Let space only in the perpendicular directions*/ + area_bg.x1 += slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/ + area_bg.x2 -= slider_w < slider_h ? pad_hor_bg : 0; /*Pad only for vertical slider*/ + area_bg.y1 += slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/ + area_bg.y2 -= slider_w > slider_h ? pad_ver_bg : 0; /*Pad only for horizontal slider*/ + } lv_draw_rect(&area_bg, mask, style_bg); /*Draw the indicator*/ diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index 5f09e1810..4347d79bc 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -366,9 +366,9 @@ static void gauge_init(void) lv_style_copy(&gauge_bg, &def); gauge_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 70); gauge_bg.body.grad_color = gauge_bg.body.main_color; - gauge_bg.body.padding.hor = LV_DPI / 12; /*Scale line length*/ + gauge_bg.body.padding.hor = LV_DPI / 16; /*Scale line length*/ gauge_bg.body.padding.ver = LV_DPI / 10; /*Needle center size*/ - gauge_bg.body.padding.inner = LV_DPI / 8; /*Label - scale distance*/ + gauge_bg.body.padding.inner = LV_DPI / 12; /*Label - scale distance*/ gauge_bg.body.border.color = LV_COLOR_HEX3(0x777); gauge_bg.line.color = lv_color_hsv_to_rgb(_hue, 80, 75); gauge_bg.line.width = 2; diff --git a/lv_themes/lv_theme_zen.c b/lv_themes/lv_theme_zen.c index d66d800aa..522f97a1d 100644 --- a/lv_themes/lv_theme_zen.c +++ b/lv_themes/lv_theme_zen.c @@ -283,10 +283,10 @@ static void gauge_init(void) lv_style_copy(&gauge, &def); gauge.line.color = lv_color_hsv_to_rgb(_hue, 50, 70); - gauge.line.width = 2; + gauge.line.width = 1; gauge.body.main_color = LV_COLOR_HEX3(0x999); gauge.body.grad_color = gauge.body.main_color; - gauge.body.padding.hor = LV_DPI / 12; + gauge.body.padding.hor = LV_DPI / 16; gauge.body.border.color = LV_COLOR_HEX3(0x666); /*Needle middle color*/ theme.gauge = &gauge; From a3ad4b361636024161c8d8beb3c2c299b66f431d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 16 May 2018 23:09:30 +0200 Subject: [PATCH 09/23] in lv_objx set functions apply the new value only if it's different from the current --- lv_objx/lv_bar.c | 6 ++++++ lv_objx/lv_chart.c | 13 +++++++++++++ lv_objx/lv_cont.c | 4 ++++ lv_objx/lv_ddlist.c | 4 +++- lv_objx/lv_gauge.c | 31 +++++++++++++++++++------------ lv_objx/lv_kb.c | 6 ++++++ lv_objx/lv_label.c | 8 ++++++++ lv_objx/lv_led.c | 2 ++ lv_objx/lv_line.c | 2 ++ lv_objx/lv_list.c | 2 ++ lv_objx/lv_lmeter.c | 10 ++++++++-- lv_objx/lv_mbox.c | 1 + lv_objx/lv_page.c | 2 ++ lv_objx/lv_roller.c | 3 +++ lv_objx/lv_slider.c | 2 ++ lv_objx/lv_sw.c | 4 ++++ lv_objx/lv_ta.c | 10 ++++++++-- lv_objx/lv_tabview.c | 2 ++ lv_objx/lv_win.c | 2 ++ 19 files changed, 97 insertions(+), 17 deletions(-) diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 4efe3fdb7..1e938995c 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -110,6 +110,8 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy) void lv_bar_set_value(lv_obj_t * bar, int16_t value) { lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); + if(ext->cur_value == value) return; + ext->cur_value = value > ext->max_value ? ext->max_value : value; ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value; lv_obj_invalidate(bar); @@ -125,6 +127,8 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value) void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time) { lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); + if(ext->cur_value == value) return; + int16_t new_value; new_value = value > ext->max_value ? ext->max_value : value; new_value = new_value < ext->min_value ? ext->min_value : new_value; @@ -157,6 +161,8 @@ void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time) void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max) { lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); + if(ext->min_value == min && ext->max_value == max) return; + ext->max_value = max; ext->min_value = min; if(ext->cur_value > max) { diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index e2b302de7..c42492858 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -159,6 +159,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color) void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->hdiv_cnt == hdiv && ext->vdiv_cnt == vdiv) return; ext->hdiv_cnt = hdiv; ext->vdiv_cnt = vdiv; @@ -175,6 +176,7 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv) void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->ymin == ymin && ext->ymax == ymax) return; ext->ymin = ymin; ext->ymax = ymax; @@ -190,6 +192,8 @@ void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax) void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->type == type) return; + ext->type = type; lv_chart_refresh(chart); @@ -203,6 +207,8 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type) void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->point_cnt == point_cnt) return; + lv_chart_series_t *ser; uint16_t point_cnt_old = ext->point_cnt; uint16_t i; @@ -233,6 +239,8 @@ void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt) void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->series.opa == opa) return; + ext->series.opa = opa; lv_obj_invalidate(chart); } @@ -245,6 +253,8 @@ void lv_chart_set_series_opa(lv_obj_t * chart, lv_opa_t opa) void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->series.width == width) return; + ext->series.width = width; lv_obj_invalidate(chart); } @@ -256,7 +266,10 @@ void lv_chart_set_series_width(lv_obj_t * chart, lv_coord_t width) void lv_chart_set_series_darking(lv_obj_t * chart, lv_opa_t dark_eff) { lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart); + if(ext->series.dark == dark_eff) return; + ext->series.dark = dark_eff; + lv_obj_invalidate(chart); } /** diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index 7a3e09be8..9d8cc0111 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -113,6 +113,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy) void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout) { lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); + if(ext->layout == layout) return; + ext->layout = layout; /*Send a signal to refresh the layout*/ @@ -131,6 +133,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en) { lv_obj_invalidate(cont); lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont); + if(ext->hor_fit == hor_en && ext->ver_fit == ver_en) return; + ext->hor_fit = hor_en == false ? 0 : 1; ext->ver_fit = ver_en == false ? 0 : 1; diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 0e3b90968..314fcdb2a 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -172,6 +172,7 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options) void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt) { lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); + if(ext->sel_opt_id == sel_opt) return; ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1; @@ -203,6 +204,8 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action) void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h) { lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); + if(ext->fix_height == h) return; + ext->fix_height = h; lv_ddlist_refr_size(ddlist, false); @@ -218,7 +221,6 @@ void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, bool fit_en) lv_cont_set_fit(ddlist, fit_en, lv_cont_get_ver_fit(ddlist)); lv_page_set_scrl_fit(ddlist, fit_en, lv_page_get_scrl_fit_ver(ddlist)); - lv_ddlist_refr_size(ddlist, false); } diff --git a/lv_objx/lv_gauge.c b/lv_objx/lv_gauge.c index 4fbb580c5..2242d32a5 100644 --- a/lv_objx/lv_gauge.c +++ b/lv_objx/lv_gauge.c @@ -127,20 +127,24 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy) void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t * colors) { lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge); - if(ext->values != NULL) { - lv_mem_free(ext->values); - ext->values = NULL; + + if(ext->needle_count != needle_cnt) { + if(ext->values != NULL) { + lv_mem_free(ext->values); + ext->values = NULL; + } + + ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(int16_t)); + + int16_t min = lv_gauge_get_min_value(gauge); + uint8_t n; + for(n = ext->needle_count; n < needle_cnt; n++) { + ext->values[n] = min; + } + + ext->needle_count = needle_cnt; } - ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(int16_t)); - - int16_t min = lv_gauge_get_min_value(gauge); - uint8_t n; - for(n = ext->needle_count; n < needle_cnt; n++) { - ext->values[n] = min; - } - - ext->needle_count = needle_cnt; ext->needle_colors = colors; lv_obj_invalidate(gauge); } @@ -156,6 +160,8 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value) lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge); if(needle_id >= ext->needle_count) return; + if(ext->values[needle_id] == value) return; + int16_t min = lv_gauge_get_min_value(gauge); int16_t max = lv_gauge_get_max_value(gauge); @@ -183,6 +189,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge); ext->label_count = label_cnt; + lv_obj_invalidate(gauge); } /*===================== diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index d7254954f..a9b7eac1b 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -146,6 +146,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta) lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb); lv_cursor_type_t cur_type; + /*Hide the cursor of the old Text area if cursor management is enabled*/ if(ext->ta && ext->cursor_mng) { cur_type = lv_ta_get_cursor_type(ext->ta); lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN); @@ -153,6 +154,7 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta) ext->ta = ta; + /*Show the cursor of the new Text area if cursor management is enabled*/ if(ext->ta && ext->cursor_mng) { cur_type = lv_ta_get_cursor_type(ext->ta); lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN)); @@ -167,6 +169,8 @@ void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta) void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode) { lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb); + if(ext->mode == mode) return; + ext->mode = mode; if(mode == LV_KB_MODE_TEXT) lv_btnm_set_map(kb, kb_map_lc); else if(mode == LV_KB_MODE_NUM) lv_btnm_set_map(kb, kb_map_num); @@ -181,6 +185,8 @@ void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode) void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en) { lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb); + if(ext->cursor_mng == en) return; + ext->cursor_mng = en == false? 0 : 1; if(ext->ta) { diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index f6f40fd09..346309813 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -253,6 +253,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode) void lv_label_set_align(lv_obj_t *label, lv_label_align_t align) { lv_label_ext_t *ext = lv_obj_get_ext_attr(label); + if(ext->align == align) return; ext->align = align; @@ -268,6 +269,7 @@ void lv_label_set_align(lv_obj_t *label, lv_label_align_t align) void lv_label_set_recolor(lv_obj_t * label, bool recolor_en) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); + if(ext->recolor == recolor_en) return; ext->recolor = recolor_en == false ? 0 : 1; @@ -282,6 +284,8 @@ void lv_label_set_recolor(lv_obj_t * label, bool recolor_en) void lv_label_set_no_break(lv_obj_t * label, bool no_break_en) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); + if(ext->no_break == no_break_en) return; + ext->no_break = no_break_en == false ? 0 : 1; lv_label_refr_text(label); @@ -295,6 +299,8 @@ void lv_label_set_no_break(lv_obj_t * label, bool no_break_en) void lv_label_set_body_draw(lv_obj_t *label, bool body_en) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); + if(ext->body_draw == body_en) return; + ext->body_draw = body_en == false ? 0 : 1; lv_obj_refresh_ext_size(label); @@ -310,6 +316,8 @@ void lv_label_set_body_draw(lv_obj_t *label, bool body_en) void lv_label_set_anim_speed(lv_obj_t *label, uint16_t anim_speed) { lv_label_ext_t *ext = lv_obj_get_ext_attr(label); + if(ext->anim_speed == anim_speed) return; + ext->anim_speed = anim_speed; if(ext->long_mode == LV_LABEL_LONG_ROLL || ext->long_mode == LV_LABEL_LONG_SCROLL) { diff --git a/lv_objx/lv_led.c b/lv_objx/lv_led.c index e14630c4b..4a11607df 100644 --- a/lv_objx/lv_led.c +++ b/lv_objx/lv_led.c @@ -104,6 +104,8 @@ void lv_led_set_bright(lv_obj_t * led, uint8_t bright) { /*Set the brightness*/ lv_led_ext_t * ext = lv_obj_get_ext_attr(led); + if(ext->bright == bright) return; + ext->bright = bright; /*Invalidate the object there fore it will be redrawn*/ diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index d3de7b578..b6e71d35e 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -129,6 +129,7 @@ void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t po void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en) { lv_line_ext_t * ext = lv_obj_get_ext_attr(line); + if(ext->auto_size == autosize_en) return; ext->auto_size = autosize_en == false ? 0 : 1; @@ -146,6 +147,7 @@ void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en) void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en) { lv_line_ext_t * ext = lv_obj_get_ext_attr(line); + if(ext->y_inv == yinv_en) return; ext->y_inv = yinv_en == false ? 0 : 1; diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 9da62adda..f272efd22 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -211,6 +211,8 @@ void lv_list_set_anim_time(lv_obj_t *list, uint16_t anim_time) #if USE_LV_ANIMATION == 0 anim_time = 0; #endif + + if(ext->anim_time == anim_time) return; ext->anim_time = anim_time; } diff --git a/lv_objx/lv_lmeter.c b/lv_objx/lv_lmeter.c index d9d0a1a84..6bda4c050 100644 --- a/lv_objx/lv_lmeter.c +++ b/lv_objx/lv_lmeter.c @@ -112,8 +112,10 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy) */ void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value) { - lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter); - ext->cur_value = value > ext->max_value ? ext->max_value : value; + lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter); + if(ext->cur_value == value) return; + + ext->cur_value = value > ext->max_value ? ext->max_value : value; ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value; lv_obj_invalidate(lmeter); } @@ -127,6 +129,8 @@ void lv_lmeter_set_value(lv_obj_t *lmeter, int16_t value) void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max) { lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter); + if(ext->min_value == min && ext->max_value == max) return; + ext->max_value = max; ext->min_value = min; if(ext->cur_value > max) { @@ -149,6 +153,8 @@ void lv_lmeter_set_range(lv_obj_t *lmeter, int16_t min, int16_t max) void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt) { lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter); + if(ext->scale_angle == angle && ext->line_cnt == line_cnt) return; + ext->scale_angle = angle; ext->line_cnt = line_cnt; diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index 4c3e57f40..5156a3a6d 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -191,6 +191,7 @@ void lv_mbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time) #if USE_LV_ANIMATION == 0 anim_time = 0; #endif + ext->anim_time = anim_time; } diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 024eea304..2f0c0fcc9 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -170,6 +170,8 @@ void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action) void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode) { lv_page_ext_t * ext = lv_obj_get_ext_attr(page); + if(ext->sb.mode == sb_mode) return; + ext->sb.mode = sb_mode; ext->sb.hor_draw = 0; ext->sb.ver_draw = 0; diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 361d4e389..de9e33c17 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -125,6 +125,9 @@ void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en) #if USE_LV_ANIMATION == 0 anim_en = false; #endif + + if(lv_roller_get_selected(roller) == sel_opt) return; + lv_ddlist_set_selected(roller, sel_opt); refr_position(roller, anim_en); } diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index e115e54e0..ed188be25 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -127,6 +127,8 @@ void lv_slider_set_action(lv_obj_t * slider, lv_action_t action) void lv_slider_set_knob_in(lv_obj_t * slider, bool in) { lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider); + if(ext->knob_in == in) return; + ext->knob_in = in == false ? 0 : 1; lv_obj_invalidate(slider); } diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index 4b667bd09..79495438e 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -112,6 +112,8 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy) */ void lv_sw_on(lv_obj_t *sw) { + if(lv_sw_get_state(sw)) return; /*Do nothing is already turned on*/ + lv_sw_ext_t *ext = lv_obj_get_ext_attr(sw); lv_slider_set_value(sw, 1); lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB,ext->style_knob_on); @@ -123,6 +125,8 @@ void lv_sw_on(lv_obj_t *sw) */ void lv_sw_off(lv_obj_t *sw) { + if(!lv_sw_get_state(sw)) return; /*Do nothing is already turned off*/ + lv_sw_ext_t *ext = lv_obj_get_ext_attr(sw); lv_slider_set_value(sw, 0); lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB,ext->style_knob_off); diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 86c5ce199..f3cca7828 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -347,6 +347,8 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + if(ext->cursor.pos == pos) return; + uint16_t len = lv_txt_get_length(lv_label_get_text(ext->label)); if(pos < 0) pos = len + pos; @@ -419,6 +421,8 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + if(ext->cursor.type == cur_type) return; + ext->cursor.type = cur_type; lv_obj_invalidate(ta); } @@ -431,6 +435,7 @@ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type) void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en) { lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + if(ext->pwd_mode == pwd_en) return; /*Pwd mode is now enabled*/ if(ext->pwd_mode == 0 && pwd_en != false) { @@ -464,8 +469,10 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool pwd_en) */ void lv_ta_set_one_line(lv_obj_t * ta, bool en) { + lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); + if(ext->one_line == en) return; + if(en != false) { - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_style_t * style_ta = lv_obj_get_style(ta); lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(ta)); lv_style_t * style_label = lv_obj_get_style(ext->label); @@ -478,7 +485,6 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en) lv_label_set_no_break(ext->label, true); lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver); } else { - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_style_t * style_ta = lv_obj_get_style(ta); ext->one_line = 0; diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 67a55842c..39cb837d9 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -241,6 +241,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en) anim_en = false; #endif lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); + if(ext->tab_cur == id) return; + lv_style_t * style = lv_obj_get_style(ext->content); if(id >= ext->tab_cnt) id = ext->tab_cnt - 1; diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 00202d5a7..e1dedffa6 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -207,6 +207,8 @@ void lv_win_set_title(lv_obj_t * win, const char * title) void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size) { lv_win_ext_t * ext = lv_obj_get_ext_attr(win); + if(ext->btn_size == size) return; + ext->btn_size = size; lv_win_realign(win); From 80cb93f8e1e2ecd64d9f9d51bf5cd119a528d62d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 16 May 2018 23:19:22 +0200 Subject: [PATCH 10/23] don't invalidate hidden objects --- lv_core/lv_obj.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index a0bbbf9ae..806fb3003 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -343,11 +343,14 @@ void lv_obj_clean(lv_obj_t *obj) */ void lv_obj_invalidate(lv_obj_t * obj) { + if(lv_obj_get_hidden(obj)) return; + /*Invalidate the object only if it belongs to the 'act_scr'*/ lv_obj_t * obj_scr = lv_obj_get_screen(obj); if(obj_scr == lv_scr_act() || obj_scr == lv_layer_top() || - obj_scr == lv_layer_sys()) { + obj_scr == lv_layer_sys()) + { /*Truncate recursively to the parents*/ lv_area_t area_trunc; lv_obj_t * par = lv_obj_get_parent(obj); @@ -363,7 +366,8 @@ void lv_obj_invalidate(lv_obj_t * obj) /*Check through all parents*/ while(par != NULL) { union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords); - if(union_ok == false) break; /*If no common parts with parent break;*/ + if(union_ok == false) break; /*If no common parts with parent break;*/ + if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/ par = lv_obj_get_parent(par); } @@ -750,12 +754,15 @@ void lv_obj_report_style_mod(lv_style_t * style) */ void lv_obj_set_hidden(lv_obj_t * obj, bool en) { + if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ + obj->hidden = en == false ? 0 : 1; - + + if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ + lv_obj_t * par = lv_obj_get_parent(obj); par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj); - lv_obj_invalidate(obj); } /** From 6be0089cacd916641c7b95c43d58f71a4fd5e39f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 16 May 2018 23:30:04 +0200 Subject: [PATCH 11/23] lv_group_del: remove the objects from the groups too --- lv_core/lv_group.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index c0902982d..16f365e71 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -58,6 +58,18 @@ lv_group_t * lv_group_create(void) */ void lv_group_del(lv_group_t * group) { + /*Defocus the the currently focussed object*/ + if(group->obj_focus != NULL) { + (*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); + lv_obj_invalidate(*group->obj_focus); + } + + /*Remove the objects from the group*/ + lv_obj_t ** obj; + LL_READ(group->obj_ll, obj) { + (*obj)->group_p = NULL; + } + lv_ll_clear(&(group->obj_ll)); lv_mem_free(group); } @@ -116,7 +128,6 @@ void lv_group_focus_obj(lv_obj_t * obj) if(g->frozen != 0) return; lv_obj_t ** i; - LL_READ(g->obj_ll, i) { if(*i == obj) { if(g->obj_focus != NULL) { From fe30f9739ba7951ca40b0d55574c2b869ca903bd Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 17 May 2018 13:05:54 +0200 Subject: [PATCH 12/23] Update TODO_PATCH.md --- docs/TODO_PATCH.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/TODO_PATCH.md b/docs/TODO_PATCH.md index 90563e580..e5de17146 100644 --- a/docs/TODO_PATCH.md +++ b/docs/TODO_PATCH.md @@ -11,6 +11,17 @@ Please create an issue to introduce a bug instead of adding pull request to this - [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED - [x] lv_group_create: init focus_cb - [x] fix of 16 bit image drawing with alpha bytes +- [x] fix text opacity +- [x] lv_mbox: enable navigation with LV_GROUP_KEY_DOWN/UP too +- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED +- [x] lv_slider: inicator draw bugfix +- [x] lv_slider: draw greater background on negative padding if knob_in == 1 +- [x] mono theme: fix typo +- [x] style animations: add opacity handling to image, text and line +- [x] lv_kb: before ok/close action don't deassign the lv_ta if there is user defined action +- [x] in lv_objx_set_... functions apply the new value only if it's different from the current +- [x] don't invalide hidden objects +- [x] lv_group_del: remove the objects from the groups too ## v5.0.3 (released on: 09.03.2018) - [x] lv_chart: Fix the use of point_num more then 256 (Thanks to upbeat27) From fc8ee11955962b8d801cf309b49816093d0a3133 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 17 May 2018 17:07:21 +0200 Subject: [PATCH 13/23] start lv_refr_task immediately on start up (don't need to wait it's period to refresh the screen) --- lv_core/lv_refr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lv_core/lv_refr.c b/lv_core/lv_refr.c index ca0840406..2c5593d66 100644 --- a/lv_core/lv_refr.c +++ b/lv_core/lv_refr.c @@ -70,7 +70,7 @@ void lv_refr_init(void) lv_task_t* task; task = lv_task_create(lv_refr_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL); - lv_mem_assert(task); + lv_task_ready(task); /*Be sure the screen will be refreshed immediately on start up*/ } /** @@ -168,6 +168,8 @@ void lv_refr_pop_from_buf(uint16_t num) */ static void lv_refr_task(void * param) { + + printf("refr\n"); (void)param; uint32_t start = lv_tick_get(); From 01b4820b9374d5848d1e11629590ed1b8987b7ee Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 20 May 2018 21:30:36 +0200 Subject: [PATCH 14/23] release v5.1.1 --- lvgl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lvgl.h b/lvgl.h index 13b1fc579..4b2613344 100644 --- a/lvgl.h +++ b/lvgl.h @@ -57,7 +57,7 @@ extern "C" { #define LVGL_VERSION_MAJOR 5 #define LVGL_VERSION_MINOR 1 #define LVGL_VERSION_PATCH 1 -#define LVGL_VERSION_INFO "beta" +#define LVGL_VERSION_INFO "" /********************** * TYPEDEFS From 7f03c17a08cbcbd44a65706d5f3077c86eba2649 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 20 May 2018 21:32:16 +0200 Subject: [PATCH 15/23] remove debug printf --- lv_core/lv_refr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lv_core/lv_refr.c b/lv_core/lv_refr.c index 2c5593d66..1081c81ae 100644 --- a/lv_core/lv_refr.c +++ b/lv_core/lv_refr.c @@ -168,8 +168,6 @@ void lv_refr_pop_from_buf(uint16_t num) */ static void lv_refr_task(void * param) { - - printf("refr\n"); (void)param; uint32_t start = lv_tick_get(); From f5d4bf8fc47a3fc7fdca4b29cf156fa768084643 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 20 May 2018 21:49:04 +0200 Subject: [PATCH 16/23] lv_tabview_set_tab_act: enable to set the act tab again: --- lv_objx/lv_tabview.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 39cb837d9..9841676a6 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -241,7 +241,6 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en) anim_en = false; #endif lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); - if(ext->tab_cur == id) return; lv_style_t * style = lv_obj_get_style(ext->content); From bf6d1148935b19de1cd30b4876da36cfec69b260 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 22 May 2018 12:49:56 +0200 Subject: [PATCH 17/23] Update TODO_PATCH.md --- docs/TODO_PATCH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/TODO_PATCH.md b/docs/TODO_PATCH.md index e5de17146..bb1331f7f 100644 --- a/docs/TODO_PATCH.md +++ b/docs/TODO_PATCH.md @@ -6,7 +6,7 @@ The bugfixes of the still not released version are in `beta` branche. ## Contributing Please create an issue to introduce a bug instead of adding pull request to this file. -## v5.1.1 (in progress) +## v5.1.1 (released on: 20.05.2018) - [x] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates - [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED - [x] lv_group_create: init focus_cb From 47fb0afe79577d133e289b217e631f2bfe48b090 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 22 May 2018 13:10:34 +0200 Subject: [PATCH 18/23] Update TODO_MINOR.md --- docs/TODO_MINOR.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/TODO_MINOR.md b/docs/TODO_MINOR.md index 96ed5fd04..58524dc9f 100644 --- a/docs/TODO_MINOR.md +++ b/docs/TODO_MINOR.md @@ -19,16 +19,29 @@ Here are ideas which are not assigned to a minor version yet: - lv_ta: add placeholder text - image rotate - -## v5.2 (in progress) -- [ ] Lua interface to craete GUI with script +## v5.3 (planned) +Mainly graphical/drawing improvments and Lua support +- [ ] API extension: turn the relevant "lv_obj" functions to the specific type (lv_btn_set_size) +- [ ] Lua interface to create GUI with script - [ ] Arabic glyph convert (based on letter position) +- [ ] Arc rawing - [ ] Right-to-left write support - [ ] Bit based VDB: 1, 2 or 4 bit -- [ ] lv_icon: new object type: an image wich acts as a button -- [ ] lv_table: new object type: a table with rows and colums -- [ ] triangle drawing -- [ ] user defined error callback +- [ ] Ttriangle drawing + +## v5.2 (in progress) +Mainly new object and new feauters: +- [ ] New object type: Listview (table) #137 +- [ ] New object type: Calendar +- [ ] New object type: Icon (button like image) #182 +- [ ] New object type: QR code #199 +- [ ] lv_page: scroll on LV_GROUP_KEY_UP/DOWN/LEFT/RIGHT +- [ ] lv_obj_align: option in lv_conf.h sav the last alignment's coordinate ad aply it on lv_obj_realign +- [ ] lv_line: perpndicular line ending +- [ ] lv_gauge: option to put lables outside of the scale +- [ ] lv_img: png support #254 +- [ ] lv_tabview: add option to put the tab button to the bottom +- [ ] Error callback: add an option to register a callback called on error - [ ] Support more character coding (e.g. UTF8, UTF16 etc) ## v5.1 (released on: 09.03.2018) From e5bba0529a8ba2080d4204fd593b1ecbbb7d754c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 26 May 2018 10:03:43 +0200 Subject: [PATCH 19/23] remove the LV_GROUP_KEY_ENTER_LONG from some objects + fix ddlist and roller ENTER --- lv_objx/lv_btnm.c | 2 +- lv_objx/lv_cb.c | 2 +- lv_objx/lv_ddlist.c | 2 +- lv_objx/lv_list.c | 2 +- lv_objx/lv_roller.c | 3 ++- lv_objx/lv_sw.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index e54115786..e6158d28c 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -627,7 +627,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) } lv_obj_invalidate(btnm); - }else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + }else if(c == LV_GROUP_KEY_ENTER) { if(ext->action != NULL) { uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); if(txt_i != LV_BTNM_PR_NONE) { diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index d2867eda2..7363f44e8 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -305,7 +305,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param) char c = *((char*)param); if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN || c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP || - c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + c == LV_GROUP_KEY_ENTER) { lv_btn_set_state(ext->bullet, lv_btn_get_state(cb)); } } diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 314fcdb2a..1aa8060bc 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -549,7 +549,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par lv_ddlist_pos_current_option(ddlist); lv_obj_invalidate(ddlist); } - } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + } else if(c == LV_GROUP_KEY_ENTER) { if(ext->opened) { ext->sel_opt_id_ori = ext->sel_opt_id; ext->opened = 0; diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index f272efd22..282a64a31 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -570,7 +570,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_page_focus(list, btn_prev, ext->anim_time); } } - } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + } else if(c == LV_GROUP_KEY_ENTER) { /*Get the 'pressed' button*/ lv_obj_t * btn = NULL; btn = get_next_btn(list, btn); diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index de9e33c17..0a02df7f5 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -321,8 +321,9 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par if(ext->ddlist.sel_opt_id > 0) { lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true); } - } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + } else if(c == LV_GROUP_KEY_ENTER) { if(ext->ddlist.action) ext->ddlist.action(roller); + ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/ } } else if(sign == LV_SIGNAL_GET_TYPE) { diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index 79495438e..274ca38a9 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -243,7 +243,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_CONTROLL) { char c = *((char*)param); - if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { + if(c == LV_GROUP_KEY_ENTER) { if(lv_sw_get_state(sw)) lv_sw_off(sw); else lv_sw_on(sw); From ad22d4b9b5eb01131f71dacc41b520a7fc5b3ef7 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 26 May 2018 10:28:58 +0200 Subject: [PATCH 20/23] LV_GROUP_KEY_ENTER_LONG: improve objects behaviour --- lv_core/lv_indev.c | 8 +++++--- lv_objx/lv_btn.c | 1 - lv_objx/lv_btnm.c | 2 +- lv_objx/lv_cb.c | 2 +- lv_objx/lv_ddlist.c | 2 +- lv_objx/lv_list.c | 2 +- lv_objx/lv_roller.c | 2 +- lv_objx/lv_sw.c | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index d2b06e6fe..6650b85f4 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -356,13 +356,15 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) data->key = i->proc.last_key; if(data->key == LV_GROUP_KEY_NEXT) { - lv_group_focus_next(i->group); + lv_group_focus_next(i->group); } else if(data->key == LV_GROUP_KEY_PREV) { lv_group_focus_prev(i->group); } - else { - lv_group_send_data(i->group, data->key); + else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) { + /*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/ + } else { + lv_group_send_data(i->group, data->key); } i->proc.pr_timestamp = 0; diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index 1ae4e4da4..352192c85 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -384,7 +384,6 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) else if(c == LV_GROUP_KEY_ENTER_LONG) { if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) { res = ext->actions[LV_BTN_ACTION_LONG_PR](btn); - ext->long_pr_action_executed = 1; } } } diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index e6158d28c..e54115786 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -627,7 +627,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) } lv_obj_invalidate(btnm); - }else if(c == LV_GROUP_KEY_ENTER) { + }else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { if(ext->action != NULL) { uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); if(txt_i != LV_BTNM_PR_NONE) { diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index 7363f44e8..d2867eda2 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -305,7 +305,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param) char c = *((char*)param); if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN || c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP || - c == LV_GROUP_KEY_ENTER) { + c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { lv_btn_set_state(ext->bullet, lv_btn_get_state(cb)); } } diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 1aa8060bc..fa48c3815 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -549,7 +549,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par lv_ddlist_pos_current_option(ddlist); lv_obj_invalidate(ddlist); } - } else if(c == LV_GROUP_KEY_ENTER) { + } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { if(ext->opened) { ext->sel_opt_id_ori = ext->sel_opt_id; ext->opened = 0; diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 282a64a31..f272efd22 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -570,7 +570,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) lv_page_focus(list, btn_prev, ext->anim_time); } } - } else if(c == LV_GROUP_KEY_ENTER) { + } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { /*Get the 'pressed' button*/ lv_obj_t * btn = NULL; btn = get_next_btn(list, btn); diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 0a02df7f5..a34da2eec 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -321,7 +321,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par if(ext->ddlist.sel_opt_id > 0) { lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true); } - } else if(c == LV_GROUP_KEY_ENTER) { + } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { if(ext->ddlist.action) ext->ddlist.action(roller); ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/ } diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index 274ca38a9..79495438e 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -243,7 +243,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_CONTROLL) { char c = *((char*)param); - if(c == LV_GROUP_KEY_ENTER) { + if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) { if(lv_sw_get_state(sw)) lv_sw_off(sw); else lv_sw_on(sw); From bc917a33b6dc0a77cfdd9c44720eda99c3358725 Mon Sep 17 00:00:00 2001 From: Michael Simon Date: Wed, 30 May 2018 13:25:56 +0200 Subject: [PATCH 21/23] Added include for lv_theme_material.h to lv_theme.h --- lv_themes/lv_theme.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lv_themes/lv_theme.h b/lv_themes/lv_theme.h index 22e7b2439..448a2f166 100644 --- a/lv_themes/lv_theme.h +++ b/lv_themes/lv_theme.h @@ -260,6 +260,7 @@ lv_theme_t * lv_theme_get_current(void); #include "lv_theme_night.h" #include "lv_theme_zen.h" #include "lv_theme_mono.h" +#include "lv_theme_material.h" #ifdef __cplusplus } /* extern "C" */ From 47cafb52b50f484b1c93990a038b0ea065e614f2 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Jun 2018 12:38:23 +0200 Subject: [PATCH 22/23] lv_draw_img: fix buffer oveflow with alpha byte --- lv_draw/lv_draw.c | 4 ++-- lvgl.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 482c74b7b..4ab088566 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -452,9 +452,9 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, 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]; + uint8_t buf[LV_HOR_RES * px_size]; # else - lv_color_t buf[LV_VER_RES]; + uint8_t buf[LV_VER_RES * px_size]; # endif #endif for(row = mask_com.y1; row <= mask_com.y2; row ++) { diff --git a/lvgl.h b/lvgl.h index 4b2613344..ba101f4d5 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 1 -#define LVGL_VERSION_INFO "" +#define LVGL_VERSION_PATCH 2 +#define LVGL_VERSION_INFO "beta" /********************** * TYPEDEFS From d7904efccfaeecd031f70a27542d79628a45f1a6 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Jun 2018 12:41:58 +0200 Subject: [PATCH 23/23] lv_draw_img: further fix on buffer oveflow --- lv_draw/lv_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 4ab088566..8225ac13c 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -449,7 +449,7 @@ 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)]; + uint8_t buf[lv_area_get_width(&mask_com) * px_size]; #else # if LV_HOR_RES > LV_VER_RES uint8_t buf[LV_HOR_RES * px_size];