From 4cd13016d34aff903090d4e1efce25866a1a676a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Feb 2019 05:44:19 +0100 Subject: [PATCH 01/22] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f30b4676..0e5ba11c7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

LittlevGL - Open-source Embedded GUI Library

- - + +

From 17c19fc35a6edcf3be80aac62baef75eb63c703d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Feb 2019 15:10:59 +0100 Subject: [PATCH 02/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e5ba11c7..324930a63 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
- +

From dc69cf82eb7bbc82eea01c67abc319398f1ca937 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Feb 2019 21:53:12 +0100 Subject: [PATCH 03/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 324930a63..fe87a15d8 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ style_btn_rel.body.radius = LV_RADIUS_CIRCLE; style_btn_rel.text.color = LV_COLOR_HEX3(0xDEF); static lv_style_t style_btn_pr; /*A variable to store the pressed style*/ -lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from a built-in style*/ +lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from the released style*/ style_btn_pr.body.border.color = LV_COLOR_HEX3(0x46B); style_btn_pr.body.main_color = LV_COLOR_HEX3(0x8BD); style_btn_pr.body.grad_color = LV_COLOR_HEX3(0x24A); From 9a272039d33ad1abd3728be3f7cb067ae6a8d8ee Mon Sep 17 00:00:00 2001 From: Themba D <42941056+embeddedt@users.noreply.github.com> Date: Fri, 1 Feb 2019 16:05:46 -0500 Subject: [PATCH 04/22] Change v5.3 to 5.3 When the badge already says 'version' it doesn't make sense to put the 'v' before the version number. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe87a15d8..8f6ebc09a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

LittlevGL - Open-source Embedded GUI Library

- +

From b66e8410f6d20aca063931988858c061016ea7cc Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 1 Feb 2019 22:27:57 +0100 Subject: [PATCH 05/22] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe87a15d8..2258ca068 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ bool touchpad_read(lv_indev_data_t * data) static lv_coord_t last_x = 0; static lv_coord_t last_y = 0; - /*Save the state and save the pressed cooridnate*/ + /*Save the state and save the pressed coordinate*/ data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y); @@ -116,9 +116,9 @@ bool touchpad_read(lv_indev_data_t * data) return false; /*Return `false` because we are not buffering and no more data to read*/ } ``` -6. Call `lv_task_handler()` periodically every few milliseconds. +6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. -For a detailed description check the [Online documatation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c) +For a detailed description check the [Documatation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c) ### Code examples From 148539d2428329a6723235ab90cb5315b2527fda Mon Sep 17 00:00:00 2001 From: 0xflotus <0xflotus@gmail.com> Date: Sat, 2 Feb 2019 02:26:49 +0100 Subject: [PATCH 06/22] fixed small errors --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2258ca068..3f1677760 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ The easiest way to get started with LittlevGL is to run it in a simulator on you Choose a project with your favourite IDE: -| Eclipse | CodeBlock | Visual Studio | PlatfomIO | Qt Creator | +| Eclipse | CodeBlock | Visual Studio | PlatformIO | Qt Creator | |-------------|----------- |---------------|-----------|------------| | [![Eclipse](https://littlevgl.com/logo/ide/eclipse.jpg)](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [![CodeBlocks](https://littlevgl.com/logo/ide/codeblocks.jpg)](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [![VisualStudio](https://littlevgl.com/logo/ide/visualstudio.jpg)](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [![PlatformIO](https://littlevgl.com/logo/ide/platformio.jpg)](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [![QtCreator](https://littlevgl.com/logo/ide/qtcreator.jpg)](https://blog.littlevgl.com/2019-01-03/qt-creator) | | Cross-platform
with SDL | Native Windows | Cross-platform
with SDL | Cross-platform
with SDL | Cross-platform
with SDL | @@ -109,7 +109,7 @@ bool touchpad_read(lv_indev_data_t * data) data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y); - /*Set the coordinates (if released use the last pressed cooridantes)*/ + /*Set the coordinates (if released use the last pressed coordinates)*/ data->point.x = last_x; data->point.y = last_y; @@ -118,7 +118,7 @@ bool touchpad_read(lv_indev_data_t * data) ``` 6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. -For a detailed description check the [Documatation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c) +For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting tutorial](https://github.com/littlevgl/lv_examples/blob/master/lv_tutorial/0_porting/lv_tutorial_porting.c) ### Code examples @@ -161,8 +161,8 @@ style_btn_pr.body.grad_color = LV_COLOR_HEX3(0x24A); style_btn_pr.body.shadow.width = 2; style_btn_pr.text.color = LV_COLOR_HEX3(0xBCD); -lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the buton's released style*/ -lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the buton's pressed style*/ +lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the button's released style*/ +lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the button's pressed style*/ ``` ![Simple button with LittelvGL](https://littlevgl.com/github/btn2.gif) From fb1a7fc0fc4857cd3eae24f35d36bca5fa5fab46 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 4 Feb 2019 15:28:01 +0100 Subject: [PATCH 07/22] Update stale.yml --- .github/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/stale.yml b/.github/stale.yml index 1b48a4379..914189811 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -7,7 +7,7 @@ exemptLabels: - architecture - pinned # Label to use when marking an issue as stale -# staleLabel: + staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue or pull request has been automatically marked as stale because it has not had From b0b1174564c0aac5e645bd5e0550faee3e4f28f3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 7 Feb 2019 10:27:18 +0100 Subject: [PATCH 08/22] lv_canvas: fix with LV_COLOR_16_SWAP --- lv_objx/lv_canvas.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lv_objx/lv_canvas.c b/lv_objx/lv_canvas.c index 12fea9783..32e47b71a 100644 --- a/lv_objx/lv_canvas.c +++ b/lv_objx/lv_canvas.c @@ -340,9 +340,27 @@ void lv_canvas_mult_buf(lv_obj_t * canvas, void * to_copy, lv_coord_t w, lv_coor lv_coord_t j; for(i = 0; i < h; i++) { for(j = 0; j < w; j++) { +#if LV_COLOR_DEPTH == 32 canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 8; canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 8; canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 8; +#elif LV_COLOR_DEPTH == 16 + + canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 5; + canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 5; +# if LV_COLOR_16_SWAP == 0 + canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 6; +# else + canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 6; + canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 6; + canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 6; +# endif /*LV_COLOR_16_SWAP*/ + +#elif LV_COLOR_DEPTH == 8 + canvas_buf_color[j].red = (uint16_t) ((uint16_t) canvas_buf_color[j].red * copy_buf_color[j].red) >> 3; + canvas_buf_color[j].green = (uint16_t) ((uint16_t) canvas_buf_color[j].green * copy_buf_color[j].green) >> 3; + canvas_buf_color[j].blue = (uint16_t) ((uint16_t) canvas_buf_color[j].blue * copy_buf_color[j].blue) >> 2; +#endif } copy_buf_color += w; canvas_buf_color += ext->dsc.header.w; From e72589c6d4c3850a4ce8c79fc77359ce4793a82e Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Fri, 8 Feb 2019 00:03:16 +0200 Subject: [PATCH 09/22] 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 10/22] 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 11/22] 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 12/22] 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 13/22] 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 14/22] 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 15/22] 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 16/22] 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 17/22] 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 18/22] 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 19/22] 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 20/22] 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 21/22] 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 22/22] 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;