修复按键“多次按下”切换到“长按”状态时会多触发一次PRESS_DOWN事件回调的bug

1,修改状态机切换的状态。
2,修改错误的代码注释。
pull/39/head
Riggin 2 years ago
parent 3e5fb48a6b
commit 2e68340382

@ -132,8 +132,8 @@ static void button_handler(struct Button* handle)
} else {
handle->state = 0;
}
} else if(handle->ticks > SHORT_TICKS) { // long press up
handle->state = 0;
} else if(handle->ticks > SHORT_TICKS) { // SHORT_TICKS < press down hold time < LONG_TICKS
handle->state = 1;
}
break;

Loading…
Cancel
Save