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 <liushuai25@xiaomi.com>

Co-authored-by: liushuai25 <liushuai25@xiaomi.com>
This commit is contained in:
刘帅 2021-08-26 19:57:15 +08:00 committed by GitHub
parent eb5eaa3940
commit 7d592edaa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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;