From 8e083fe175d8620e239a840aa5f938e04fc9f968 Mon Sep 17 00:00:00 2001 From: nhkefus Date: Thu, 20 Mar 2025 16:04:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E5=87=BB=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TC1/user_gpio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TC1/user_gpio.c b/TC1/user_gpio.c index 3c6feb5..e8ab8d6 100644 --- a/TC1/user_gpio.c +++ b/TC1/user_gpio.c @@ -230,16 +230,19 @@ static void KeyTimeoutHandler(void *arg) { } else if (key_time > 100) { MicoSystemReboot(); } - mico_rtos_stop_timer(&user_key_timer); + key_time = 0; // 只重置,不要马上 stop timer } - // 多击判定逻辑(100ms为单位) +// 多击判定处理 if (waiting_click_end) { click_timer++; - if (click_timer >= 3) { // 300ms内没有新击,判定结束 + if (click_timer >= 5) { KeyShortPress(click_count); click_count = 0; waiting_click_end = false; + click_timer = 0; + // ✅ 此时再 stop timer(可选) + mico_rtos_stop_timer(&user_key_timer); } } }