merge beta

This commit is contained in:
Gabor Kiss-Vamosi
2018-06-07 15:41:22 +02:00
35 changed files with 268 additions and 78 deletions

View File

@@ -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:

View File

@@ -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)

View File

@@ -6,8 +6,22 @@ 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)
- [ ] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates
## 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
- [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)

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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);
}
/**

View File

@@ -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*/
}
/**

View File

@@ -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
@@ -449,12 +449,12 @@ 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
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 ++) {
@@ -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,7 +1836,7 @@ 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]);

View File

@@ -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
**********************/

View File

@@ -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
**********************/

View File

@@ -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;
}
/**

View File

@@ -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) {

View File

@@ -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;
}
}
}

View File

@@ -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);
}
/**

View File

@@ -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;

View File

@@ -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);
}
@@ -547,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 || c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->opened) {
ext->sel_opt_id_ori = ext->sel_opt_id;
ext->opened = 0;

View File

@@ -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);
}
/*=====================

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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*/

View File

@@ -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;

View File

@@ -221,6 +221,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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -180,6 +180,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;

View File

@@ -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);
}
@@ -320,6 +323,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
}
} 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*/
}
}
else if(sign == LV_SIGNAL_GET_TYPE) {

View File

@@ -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);
}
@@ -273,11 +275,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*/

View File

@@ -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);

View File

@@ -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;

View File

@@ -251,6 +251,7 @@ 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);
lv_style_t * style = lv_obj_get_style(ext->content);
if(id >= ext->tab_cnt) id = ext->tab_cnt - 1;

View File

@@ -216,6 +216,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);

View File

@@ -258,7 +258,9 @@ 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"
#include "lv_theme_material.h"
#ifdef __cplusplus
} /* extern "C" */

View File

@@ -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;

View File

@@ -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;

1
lvgl.h
View File

@@ -57,7 +57,6 @@ extern "C" {
#define LVGL_VERSION_MAJOR 5
#define LVGL_VERSION_MINOR 2
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO "beta"
/**********************