-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug 注意!按键多次抖动导致 长按不调用解决方法 #15
Comments
else if(handle->ticks > SHORT_TICKS){ 添加成这个 |
添加成 |
@SSEHX你说的这种情况作者确实没有考虑到,按照代码里的思路,在连续按下、抬起的过程中突然保持按下的动作不变,此时应该切换为状态5也就是长按状态,但是代码卡死在了状态3,因为它必须等待按键抬起。 case 3:
if(handle->button_level != handle->active_level) { //released press up
handle->event = (uint8_t)PRESS_UP;
EVENT_CB(PRESS_UP);
if(handle->ticks < SHORT_TICKS) {
handle->ticks = 0;
handle->state = 2; //repeat press
} else {
handle->state = 0;
}
} else if(handle->ticks > SHORT_TICKS) {
handle->state = 0;
}
break; |
This was referenced Apr 20, 2021
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在multi button .c文件
第132 行!!!!
添加 else {
handle->state = 0;
}
即可解决,
不然会导致长按不生效
!!!!
The text was updated successfully, but these errors were encountered: