修复功能

1->修复了   PRESS_REPEAT 事件会错误的调用DOUBLE_CLICK 事件
2->现在 DOUBLE_CLICK 事件会被正确的调用
pull/8/head
sj13757790563 6 years ago
parent b03465e848
commit 29bb10be9a

@ -104,9 +104,6 @@ void button_handler(struct Button* handle)
handle->event = (uint8_t)PRESS_DOWN; handle->event = (uint8_t)PRESS_DOWN;
EVENT_CB(PRESS_DOWN); EVENT_CB(PRESS_DOWN);
handle->repeat++; handle->repeat++;
if(handle->repeat == 2) {
EVENT_CB(DOUBLE_CLICK); // repeat hit
}
EVENT_CB(PRESS_REPEAT); // repeat hit EVENT_CB(PRESS_REPEAT); // repeat hit
handle->ticks = 0; handle->ticks = 0;
handle->state = 3; handle->state = 3;
@ -116,6 +113,7 @@ void button_handler(struct Button* handle)
EVENT_CB(SINGLE_CLICK); EVENT_CB(SINGLE_CLICK);
} else if(handle->repeat == 2) { } else if(handle->repeat == 2) {
handle->event = (uint8_t)DOUBLE_CLICK; handle->event = (uint8_t)DOUBLE_CLICK;
EVENT_CB(DOUBLE_CLICK); // repeat hit
} }
handle->state = 0; handle->state = 0;
} }

Loading…
Cancel
Save