From 29bb10be9ad1642cb4e5095eeae98a8651438703 Mon Sep 17 00:00:00 2001 From: sj13757790563 Date: Thu, 5 Dec 2019 15:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1->修复了 PRESS_REPEAT 事件会错误的调用DOUBLE_CLICK 事件 2->现在 DOUBLE_CLICK 事件会被正确的调用 --- multi_button.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/multi_button.c b/multi_button.c index 752f2d2..5c1385b 100644 --- a/multi_button.c +++ b/multi_button.c @@ -103,10 +103,7 @@ void button_handler(struct Button* handle) if(handle->button_level == handle->active_level) { //press down again handle->event = (uint8_t)PRESS_DOWN; EVENT_CB(PRESS_DOWN); - handle->repeat++; - if(handle->repeat == 2) { - EVENT_CB(DOUBLE_CLICK); // repeat hit - } + handle->repeat++; EVENT_CB(PRESS_REPEAT); // repeat hit handle->ticks = 0; handle->state = 3; @@ -116,6 +113,7 @@ void button_handler(struct Button* handle) EVENT_CB(SINGLE_CLICK); } else if(handle->repeat == 2) { handle->event = (uint8_t)DOUBLE_CLICK; + EVENT_CB(DOUBLE_CLICK); // repeat hit } handle->state = 0; }