MultiButton
MultiButton copied to clipboard
BTN_STATE_REPEAT 状态疑问
case BTN_STATE_REPEAT:
if (handle->button_level != handle->active_level) {
// Button released
handle->event = (uint8_t)BTN_PRESS_UP;
EVENT_CB(BTN_PRESS_UP);
if (handle->ticks < SHORT_TICKS) {
handle->ticks = 0;
handle->state = BTN_STATE_RELEASE; // Continue waiting for more presses
} else {
handle->state = BTN_STATE_IDLE; // End of sequence
}
} else if (handle->ticks > SHORT_TICKS) {
// Held down too long, treat as normal press
handle->state = BTN_STATE_PRESS;
}
break;
重复按下,状态,按键重新释放,这个条件 if (handle->ticks < SHORT_TICKS) 是否多余? 要么按键持续按下超过 SHORT_TICKS 转换状态。要么在 SHORT_TICKS 内释放按键
请问是什么情况下需要处理这种情况?如果不处理是有异常? handle->ticks == SHORT_TICKS)