fix(demo): fix warning. (#3344)

* fix(demo): fix warning.

lvgl/demos/keypad_encoder/lv_demo_keypad_encoder.c:169:5: warning: "LV_EX_MOUSEWHEEL" is not defined, evaluates to 0 [-Wundef]
  169 | #if LV_EX_MOUSEWHEEL
      |     ^~~~~~~~~~~~~~~~

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

* fix benchmark warning.

~/lvgl/demos/benchmark/lv_demo_benchmark.c:1069:33: warning: cast between incompatible function types from ‘void (*)(lv_obj_t , uint16_t)’ {aka ‘void ()(struct _lv_obj_t , short unsigned int)’} to ‘void ()(void , int32_t)’ {aka ‘void ()(void , int)’} [-Wcast-function-type]
1069 | lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) lv_arc_set_end_angle);
| ^
~/lvgl/demos/benchmark/lv_demo_benchmark.c: In function ‘fall_anim’:
~/lvgl/demos/benchmark/lv_demo_benchmark.c:1090:29: warning: cast between incompatible function types from ‘void ()(struct _lv_obj_t , lv_coord_t)’ {aka ‘void ()(struct _lv_obj_t , short int)’} to ‘void ()(void , int32_t)’ {aka ‘void ()(void *, int)’} [-Wcast-function-type]
1090 | lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) lv_obj_set_y);
|

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>

Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech 2022-05-14 13:35:12 +08:00 committed by GitHub
parent 58b75f1175
commit 0d6c08105a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -1049,6 +1049,11 @@ static void line_create(lv_style_t * style)
}
static void arc_anim_end_angle_cb(void * var, int32_t v)
{
lv_arc_set_end_angle(var, v);
}
static void arc_create(lv_style_t * style)
{
uint32_t i;
@ -1066,7 +1071,7 @@ static void arc_create(lv_style_t * style)
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) lv_arc_set_end_angle);
lv_anim_set_exec_cb(&a, arc_anim_end_angle_cb);
lv_anim_set_values(&a, 0, 359);
lv_anim_set_time(&a, t);
lv_anim_set_playback_time(&a, t);
@ -1078,6 +1083,11 @@ static void arc_create(lv_style_t * style)
}
static void fall_anim_y_cb(void * var, int32_t v)
{
lv_obj_set_y(var, v);
}
static void fall_anim(lv_obj_t * obj)
{
lv_obj_set_x(obj, rnd_next(0, lv_obj_get_width(scene_bg) - lv_obj_get_width(obj)));
@ -1087,7 +1097,7 @@ static void fall_anim(lv_obj_t * obj)
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t) lv_obj_set_y);
lv_anim_set_exec_cb(&a, fall_anim_y_cb);
lv_anim_set_values(&a, 0, lv_obj_get_height(scene_bg) - lv_obj_get_height(obj));
lv_anim_set_time(&a, t);
lv_anim_set_playback_time(&a, t);

View File

@ -166,9 +166,6 @@ static void msgbox_create(void)
lv_obj_add_event_cb(mbox, msgbox_event_cb, LV_EVENT_ALL, NULL);
lv_group_focus_obj(lv_msgbox_get_btns(mbox));
lv_obj_add_state(lv_msgbox_get_btns(mbox), LV_STATE_FOCUS_KEY);
#if LV_EX_MOUSEWHEEL
lv_group_set_editing(g, true);
#endif
lv_group_focus_freeze(g, true);
lv_obj_align(mbox, LV_ALIGN_CENTER, 0, 0);