Skip to content

Commit

Permalink
lv_gauge: fix invalidation with angle offset
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Sep 16, 2020
1 parent 7756d70 commit 565643e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lv_widgets/lv_gauge.c
Expand Up @@ -207,7 +207,7 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
int16_t angle_ofs = 90 + (360 - angle) / 2;
int16_t angle_ofs = 90 + (360 - angle) / 2 + lv_gauge_get_angle_offset(gauge);
lv_point_t p_mid;
lv_point_t p_end;
lv_coord_t needle_w;
Expand Down Expand Up @@ -240,10 +240,10 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
p_end.y = (_lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
p_end.x = (_lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;

a.x1 = LV_MATH_MIN(p_mid.x, p_end.x);
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y);
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x);
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y);
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x) - needle_w;
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y) - needle_w;
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x) + needle_w;
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y) + needle_w;
lv_obj_invalidate_area(gauge, &a);


Expand Down

0 comments on commit 565643e

Please sign in to comment.