1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

arc: use value_update in lv_arc_set_value

it was overwritten on merge
This commit is contained in:
Gabor Kiss-Vamosi 2020-09-01 16:45:36 +02:00
parent fb6e7deadf
commit 03c3838605

View File

@ -400,36 +400,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
if(ext->cur_value == new_value) return;
ext->cur_value = new_value;
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
int16_t angle;
switch(ext->type) {
case LV_ARC_TYPE_SYMMETRIC:
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
if(ext->cur_value < range_midpoint) {
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
lv_arc_set_start_angle(arc, angle);
lv_arc_set_end_angle(arc, bg_midpoint);
}
else {
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
lv_arc_set_start_angle(arc, bg_midpoint);
lv_arc_set_end_angle(arc, angle);
}
break;
case LV_ARC_TYPE_REVERSE:
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
lv_arc_set_start_angle(arc, angle);
break;
default: /** LV_ARC_TYPE_NORMAL*/
angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end);
lv_arc_set_start_angle(arc, ext->bg_angle_start);
lv_arc_set_end_angle(arc, angle);
}
ext->last_angle = angle; /*Cache angle for slew rate limiting*/
value_update(arc);
}
/**