1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix messed up function introduced in 6e9714c5

This commit is contained in:
Gabor Kiss-Vamosi 2020-10-27 13:49:47 +01:00
parent 6e9714c545
commit 4dafa10017
3 changed files with 12 additions and 13 deletions

View File

@ -2,6 +2,7 @@
## v7.7.1 (04.11.2020)
### Bugfixes
- Respect btnmatrix's `one_check` in `lv_btnmatrix_set_btn_ctrl`
## v7.7.0 (20.10.2020)

View File

@ -272,22 +272,14 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
* An element of the map should look like e.g.:
* `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE`
*/
void lv_btnmatrix_set_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
void lv_btnmatrix_set_ctrl_map(lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[])
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
_lv_memcpy(ext->ctrl_bits, ctrl_map, sizeof(lv_btnmatrix_ctrl_t) * ext->btn_cnt);
if(btn_id >= ext->btn_cnt) return;
/*Uncheck all buttons if required*/
if(ext->one_check && (ctrl & LV_BTNMATRIX_CTRL_CHECK_STATE)) {
lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CHECK_STATE);
ext->btn_id_act = btn_id;
}
ext->ctrl_bits[btn_id] |= ctrl;
invalidate_button_area(btnm, btn_id);
lv_btnmatrix_set_map(btnm, ext->map_p);
}
/**
@ -330,7 +322,7 @@ void lv_btnmatrix_set_recolor(const lv_obj_t * btnm, bool en)
* @param btnm pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
*/
void lv_btnmatrix_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
void lv_btnmatrix_set_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
@ -338,6 +330,12 @@ void lv_btnmatrix_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnmat
if(btn_id >= ext->btn_cnt) return;
/*Uncheck all buttons if required*/
if(ext->one_check && (ctrl & LV_BTNMATRIX_CTRL_CHECK_STATE)) {
lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CHECK_STATE);
ext->btn_id_act = btn_id;
}
ext->ctrl_bits[btn_id] |= ctrl;
invalidate_button_area(btnm, btn_id);
}

View File

@ -127,7 +127,7 @@ void lv_btnmatrix_set_recolor(const lv_obj_t * btnm, bool en);
* @param btnm pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
*/
void lv_btnmatrix_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl);
void lv_btnmatrix_set_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl);
/**
* Clear the attributes of a button of the button matrix