From fbe838730fc9d3cbab35783d40b2a6b577bde678 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 28 Feb 2019 06:56:10 +0100 Subject: [PATCH 1/6] lv_btnm: init recolor to 0 --- lv_objx/lv_btnm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 07e6a72b2..68d04e19e 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -84,6 +84,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy) ext->action = NULL; ext->map_p = NULL; ext->toggle = 0; + ext->recolor = 0; ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel; ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr; ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel; From f509d8fa4f90a2cd2737f8b320c30de0081da737 Mon Sep 17 00:00:00 2001 From: Themba Dube Date: Wed, 27 Feb 2019 10:55:39 +0100 Subject: [PATCH 2/6] Apply ta label size fix from dev-6.0 --- lv_objx/lv_ta.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 69c12ce03..e3492a039 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -1104,6 +1104,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) { lv_res_t res; + lv_obj_t * ta = lv_obj_get_parent(scrl); + lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); /* Include the ancient signal function */ res = scrl_signal(scrl, sign, param); @@ -1111,12 +1113,27 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void if(sign == LV_SIGNAL_REFR_EXT_SIZE) { /*Set ext. size because the cursor might be out of this object*/ - lv_obj_t * ta = lv_obj_get_parent(scrl); - lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta); lv_style_t * style_label = lv_obj_get_style(ext->label); lv_coord_t font_h = lv_font_get_height(style_label->text.font); scrl->ext_size = LV_MATH_MAX(scrl->ext_size, style_label->text.line_space + font_h); } +#if 0 + else if(sign == LV_SIGNAL_CORD_CHG) { + /*Set the label width according to the text area width*/ + if(ext->label) { + if(lv_obj_get_width(ta) != lv_area_get_width(param) || + lv_obj_get_height(ta) != lv_area_get_height(param)) { + lv_obj_t * scrl = lv_page_get_scrl(ta); + lv_style_t * style_scrl = lv_obj_get_style(scrl); + lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor); + lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver); + lv_label_set_text(ext->label, NULL); /*Refresh the label*/ + + refr_cursor_area(ta); + } + } + } +#endif return res; } From 6f53e4616a2b84d34993062bf55b3e49c64b49ae Mon Sep 17 00:00:00 2001 From: Amir Gonnen Date: Sun, 3 Mar 2019 00:11:36 +0200 Subject: [PATCH 3/6] Workaround for stray 'free' macro Related to littlevgl/lv_binding_micropython#11 'Build error for STM32 port due to 'free()' macro' --- lv_misc/lv_fs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lv_misc/lv_fs.c b/lv_misc/lv_fs.c index 64edc1032..1828e39ff 100644 --- a/lv_misc/lv_fs.c +++ b/lv_misc/lv_fs.c @@ -21,6 +21,14 @@ * DEFINES *********************/ +/* "free" is used as a function pointer (in lv_fs_drv_t). + * We must make sure "free" was not defined to a platform specific + * free function, otherwise compilation would fail. + */ +#ifdef free +#undef free +#endif + /********************** * TYPEDEFS **********************/ From b8c6783207ce8060a25cddb730edd63ee72abfd3 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 3 Mar 2019 08:13:13 +0100 Subject: [PATCH 4/6] Update README.md --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cadf11e16..8ffb2a691 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Choose a project with your favourite IDE: ### Porting to an embedded hardware In the most simple case you need to do these steps: 1. Copy `lv_conf_templ.h` as `lv_conf.h` next to `lvgl` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`. -2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10) +2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL. 3. Call `lv_init()` 4. Register a function which can **copy a pixel array** to an area of the screen: ```c @@ -117,7 +117,7 @@ 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 in the main `while(1)` loop, in Timer interrupt or in an Operation system task. +6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. It will redraw the screen if required, handle input devices etc. 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) @@ -180,9 +180,7 @@ lv_btn_set_ink_out_time(btn, 300); #### Use LittlevGL from Micropython ```python - # Create a Button and a Label - scr = lv.obj() btn = lv.btn(scr) btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0) @@ -190,16 +188,16 @@ label = lv.label(btn) label.set_text("Button") # Load the screen - lv.scr_load(scr) ``` Check out the [Documentation](https://docs.littlevgl.com/) for more! ### Contributing -To ask questions and discuss topics we use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues). -You contribute in several ways: -- **Answer other's question** click the Watch button on the top to get notified about the issues +To ask questions please use the [Forum](https://forum.littlevgl.com). +FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues). +You can contribute in several ways: +- **Answer other's question** in the Forum - **Report and/or fix bugs** using the issue tracker and in Pull-request - **Suggest and/or implement new features** using the issue tracker and in Pull-request - **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs) From 78574541e33b7ab1ace384875cba5169fc72a98a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 5 Mar 2019 15:32:09 +0100 Subject: [PATCH 5/6] lv_tileview: infinite loop bugfix --- lv_objx/lv_tileview.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lv_objx/lv_tileview.c b/lv_objx/lv_tileview.c index c80cfecad..f5c2cba92 100644 --- a/lv_objx/lv_tileview.c +++ b/lv_objx/lv_tileview.c @@ -334,6 +334,8 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void if(res != LV_RES_OK) return res; lv_obj_t * tileview = lv_obj_get_parent(scrl); + lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_BG); + /*Apply constraint on moving of the tileview*/ if(sign == LV_SIGNAL_CORD_CHG) { @@ -377,7 +379,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void lv_page_start_edge_flash(tileview); } - lv_obj_set_y(scrl, -ext->act_id.y * h); + lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver); } } if(ext->drag_bottom_en == 0 && indev->proc.vect.y < 0 && ext->drag_hor == 0) { @@ -390,7 +392,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void } } - lv_obj_set_y(scrl, -ext->act_id.y * h); + lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver); } if(ext->drag_left_en == 0) { if(x > -(ext->act_id.x * w) && indev->proc.vect.x > 0 && ext->drag_ver == 0) { @@ -401,7 +403,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void lv_page_start_edge_flash(tileview); } - lv_obj_set_x(scrl, -ext->act_id.x * w); + lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor); } } if(ext->drag_right_en == 0 && indev->proc.vect.x < 0 && ext->drag_ver == 0) { @@ -414,12 +416,12 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void } } - lv_obj_set_x(scrl, -ext->act_id.x * w); + lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor); } /*Apply the drag constraints*/ - if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview)); - if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview)); + if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview) + style_bg->body.padding.ver); + if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview) + style_bg->body.padding.hor); } } From 66e70afbb4873a7dd1fd34aa273f2fa86cb7ed39 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 6 Mar 2019 16:13:04 +0100 Subject: [PATCH 6/6] use the obj->top on focus to bring the obj. to the foregorund --- lv_core/lv_group.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 46b71d15f..3fd4120f6 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -24,6 +24,7 @@ static void style_mod_def(lv_style_t * style); static void style_mod_edit_def(lv_style_t * style); static void lv_group_refocus(lv_group_t *g); +static void obj_to_foreground(lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -181,6 +182,9 @@ void lv_group_focus_obj(lv_obj_t * obj) (*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL); if(g->focus_cb) g->focus_cb(g); lv_obj_invalidate(*g->obj_focus); + + /*If the object or its parent has `top == true` bring it to the foregorund*/ + obj_to_foreground(*g->obj_focus); } break; } @@ -215,6 +219,9 @@ void lv_group_focus_next(lv_group_t * group) lv_obj_invalidate(*group->obj_focus); if(group->focus_cb) group->focus_cb(group); + + /*If the object or its parent has `top == true` bring it to the foregorund*/ + obj_to_foreground(*group->obj_focus); } } @@ -246,6 +253,9 @@ void lv_group_focus_prev(lv_group_t * group) lv_obj_invalidate(*group->obj_focus); if(group->focus_cb) group->focus_cb(group); + + /*If the object or its parent has `top == true` bring it to the foregorund*/ + obj_to_foreground(*group->obj_focus); } } @@ -522,4 +532,23 @@ static void style_mod_edit_def(lv_style_t * style) } +static void obj_to_foreground(lv_obj_t * obj) +{ + /*Search for 'top' attribute*/ + lv_obj_t * i = obj; + lv_obj_t * last_top = NULL; + while(i != NULL) { + if(i->top != 0) last_top = i; + i = lv_obj_get_parent(i); + } + + if(last_top != NULL) { + /*Move the last_top object to the foreground*/ + lv_obj_t * par = lv_obj_get_parent(last_top); + /*After list change it will be the new head*/ + lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top); + lv_obj_invalidate(last_top); + } +} + #endif /*USE_LV_GROUP != 0*/