From 7d592edaa080ed27551887158ee1acaba1c7ab72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= <33112916+shuai532209720@users.noreply.github.com> Date: Thu, 26 Aug 2021 19:57:15 +0800 Subject: [PATCH] fix(example) scroll example sqort types (#2498) line 32 of lv_example_scroll_6.c, if LV_USE_LARGE_COORD not configured, x_sqr will overflow when r is greater than 256. Signed-off-by: liushuai25 Co-authored-by: liushuai25 --- examples/scroll/lv_example_scroll_6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/scroll/lv_example_scroll_6.c b/examples/scroll/lv_example_scroll_6.c index 010af3b82..152e2c42e 100644 --- a/examples/scroll/lv_example_scroll_6.c +++ b/examples/scroll/lv_example_scroll_6.c @@ -29,7 +29,7 @@ static void scroll_event_cb(lv_event_t * e) x = r; } else { /*Use Pythagoras theorem to get x from radius and y*/ - lv_coord_t x_sqr = r * r - diff_y * diff_y; + uint32_t x_sqr = r * r - diff_y * diff_y; lv_sqrt_res_t res; lv_sqrt(x_sqr, &res, 0x8000); /*Use lvgl's built in sqrt root function*/ x = r - res.i;