1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(btnmatrix): make ORed values work correctly with lv_btnmatrix_has_btn_ctrl (#2571)

This commit replaces the current `actual & expected` check in
`lv_btnmatrix_has_btn_ctrl` with `(actual & expected) == expected`. This
is required to make the function work with ORed control flags because
otherwise a parity in *any* bit will result in a return value of `true`
even if not all expected bits are set.
This commit is contained in:
Johannes Marbach 2021-09-22 12:03:19 +02:00 committed by GitHub
parent 47734c4abe
commit 51f3310592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -32,6 +32,7 @@
- fix(zoom) multiplication overflow with zoom calculations on 16-bit platforms
- feat(msgbox): omit title label unless needed
- feat(msgbox): add function to get selected button index
- fix(btnmatrix): make ORed values work correctly with lv_btnmatrix_has_btn_ctrl
## v8.0.2 (16.07.2021)
- fix(theme) improve button focus of keyboard

View File

@ -331,7 +331,7 @@ bool lv_btnmatrix_has_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctr
lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;;
if(btn_id >= btnm->btn_cnt) return false;
return (btnm->ctrl_bits[btn_id] & ctrl) ? true : false;
return ((btnm->ctrl_bits[btn_id] & ctrl) == ctrl) ? true : false;
}
bool lv_btnmatrix_get_one_checked(const lv_obj_t * obj)