From a4c19ceea08e9345eef9a24e883c97c001e8ce45 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 19 Jun 2023 11:03:15 +0800 Subject: [PATCH] touch_element: fix unintended integer division --- components/touch_element/touch_slider.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/touch_element/touch_slider.c b/components/touch_element/touch_slider.c index ad506597e0..4d9e5f28e2 100644 --- a/components/touch_element/touch_slider.c +++ b/components/touch_element/touch_slider.c @@ -628,7 +628,7 @@ static uint32_t slider_filter_average(te_slider_handle_t slider_handle, uint32_t for (int win_idx = 0; win_idx < TE_SLD_DEFAULT_POS_FILTER_SIZE(s_te_sld_obj); win_idx++) { //Moving average filter position_average += slider_handle->pos_filter_window[win_idx]; } - position_average = position_average / TE_SLD_DEFAULT_POS_FILTER_SIZE(s_te_sld_obj) + 0.5; + position_average = (uint32_t)((float)position_average / TE_SLD_DEFAULT_POS_FILTER_SIZE(s_te_sld_obj) + 0.5F); return position_average; }