From de44f74522d74e51c47129b9510644115476cc13 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 4 Jan 2021 15:11:23 +0100 Subject: [PATCH] fix(gauge): fix redraw with image needle fix #1993 --- CHANGELOG.md | 5 +++-- src/lv_widgets/lv_gauge.c | 12 +++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 762e870dd..62001acaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## v7.9.0 +## v7.9.0 (Plann1d at 05.01.2020 ### New features - feat(chart) add lv_chart_remove_series and lv_chart_hide_series @@ -16,8 +16,9 @@ - fix(textarea) cursor position after hiding character in password mode - fix(linemeter) draw critical lines with correct color - fix(layout) stop layout after recursion threshold is reached +- fix(gauge) fix redraw with image needle -## v7.8.1 (Plannad at 15.12.2020) +## v7.8.1 ### Bugfixes - fix(lv_scr_load_anim) fix when multiple screen are loaded at tsame time with delay diff --git a/src/lv_widgets/lv_gauge.c b/src/lv_widgets/lv_gauge.c index 46bfd729c..ad3bcb066 100644 --- a/src/lv_widgets/lv_gauge.c +++ b/src/lv_widgets/lv_gauge.c @@ -197,15 +197,9 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value) int32_t old_value = ext->values[needle_id]; ext->values[needle_id] = value; - // lv_obj_invalidate(gauge); - - lv_style_int_t pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_NEEDLE); - lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN); - lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN); - lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN); - lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad; - lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad; - lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad; + lv_coord_t r = lv_obj_get_width(gauge) / 2; + lv_coord_t x_ofs = gauge->coords.x1 + r; + lv_coord_t y_ofs = gauge->coords.y1 + r; uint16_t angle = lv_linemeter_get_scale_angle(gauge); int16_t angle_ofs = 90 + (360 - angle) / 2 + lv_gauge_get_angle_offset(gauge); lv_point_t p_mid;