mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13:00 +08:00
fix:(BtnMatrix) Backport https://github.com/lvgl/lvgl/pull/4185
Stop disabled/hidden button matrix keys from getting stuck in a loop
This commit is contained in:
parent
1713cd3fd8
commit
07bce7466d
@ -563,9 +563,15 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
else btnm->btn_id_sel++;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0;
|
||||
|
||||
uint16_t btn_id_start = btnm->btn_id_sel;
|
||||
while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) {
|
||||
btnm->btn_id_sel++;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0;
|
||||
|
||||
if(btnm->btn_id_sel == btn_id_start) {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(c == LV_KEY_LEFT) {
|
||||
@ -574,9 +580,15 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
if(btnm->btn_id_sel == 0) btnm->btn_id_sel = btnm->btn_cnt - 1;
|
||||
else if(btnm->btn_id_sel > 0) btnm->btn_id_sel--;
|
||||
|
||||
uint16_t btn_id_start = btnm->btn_id_sel;
|
||||
while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) {
|
||||
if(btnm->btn_id_sel > 0) btnm->btn_id_sel--;
|
||||
else btnm->btn_id_sel = btnm->btn_cnt - 1;
|
||||
|
||||
if(btnm->btn_id_sel == btn_id_start) {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(c == LV_KEY_DOWN) {
|
||||
@ -586,7 +598,10 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
btnm->btn_id_sel = 0;
|
||||
while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) {
|
||||
btnm->btn_id_sel++;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -614,7 +629,10 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
btnm->btn_id_sel = 0;
|
||||
while(button_is_hidden(btnm->ctrl_bits[btnm->btn_id_sel]) || button_is_inactive(btnm->ctrl_bits[btnm->btn_id_sel])) {
|
||||
btnm->btn_id_sel++;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) btnm->btn_id_sel = 0;
|
||||
if(btnm->btn_id_sel >= btnm->btn_cnt) {
|
||||
btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user