From 6c44706fd7eb96d009c09a0a32609a0aeccb0dc2 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Thu, 3 Oct 2024 19:56:11 +0800 Subject: [PATCH] =?utf8?q?=20=E6=B7=BB=E5=8A=A0=20BUTTON1=5FCLICKUP=5FOTHE?= =?utf8?q?R=20=E4=BA=8B=E4=BB=B6=20function=E8=BF=9E=E7=BB=AD=E6=8C=898?= =?utf8?q?=E6=AC=A1=E8=A7=A6=E5=8F=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../application/brandy/brandy_standard/input_app.c | 13 +++++++++---- .../application/brandy/brandy_standard/input_app.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/input_app.c b/code/sdk/application/brandy/brandy_standard/input_app.c index 2dd44018d..8bd21d528 100755 --- a/code/sdk/application/brandy/brandy_standard/input_app.c +++ b/code/sdk/application/brandy/brandy_standard/input_app.c @@ -282,7 +282,7 @@ static event_button_t button_event_get(button_id_t id, button_report_state_t sta event = BUTTON1_START; } - if ((state == BUTTON_PRESS) || (state == BUTTON_CLICK) || (state == BUTTON_DOUBLE_CLICK)) { + if ((state == BUTTON_PRESS) || (state == BUTTON_CLICK) || (state == BUTTON_DOUBLE_CLICK)|| (state == BUTTON_OTHER_CLICK)) { return (event + state + 1); } else { return (event + state - 1); @@ -360,10 +360,10 @@ static void button_report_click_state(button_id_t id) g_button[id].click_cnt++; g_button[id].click_start_time = g_button[id].end_time; } - /* click invilid */ + /* click invilid click次数超过BUTTON_INVILID_CLICK_TIMES ,就上报指定事件 */ if (g_button[id].click_cnt + 1 > BUTTON_INVILID_CLICK_TIMES) { #if (CONFIG_SUPPORT_BUTTON_DOUBLE_CLICK == YES) - button_send_event_to_ui(id, BUTTON_DOUBLE_CLICK); + button_send_event_to_ui(id, BUTTON_DOUBLE_CLICK); //双击 #else button_send_event_to_ui(id, BUTTON_CLICK); #endif @@ -380,7 +380,12 @@ static void button_report_click_state(button_id_t id) /* click more than two times */ if (g_button[id].click_cnt + 1 >= BUTTON_DEFAULT_MAX_CLICK_TIMES) { #if (CONFIG_SUPPORT_BUTTON_DOUBLE_CLICK == YES) - button_send_event_to_ui(id, BUTTON_DOUBLE_CLICK); + if ( (g_button[id].click_cnt +1) == 8) //连续按8次 + button_send_event_to_ui(id, BUTTON_OTHER_CLICK); + else if ( (g_button[id].click_cnt +1) == 2) + button_send_event_to_ui(id, BUTTON_DOUBLE_CLICK); //双击 + else + button_send_event_to_ui(id, BUTTON_CLICK); //其他情况只报单击 #else button_send_event_to_ui(id, BUTTON_CLICK); #endif diff --git a/code/sdk/application/brandy/brandy_standard/input_app.h b/code/sdk/application/brandy/brandy_standard/input_app.h index 8cf2557e5..8f9231bc0 100755 --- a/code/sdk/application/brandy/brandy_standard/input_app.h +++ b/code/sdk/application/brandy/brandy_standard/input_app.h @@ -77,6 +77,7 @@ typedef enum { BUTTON1_PRESS, BUTTON1_CLICKUP, BUTTON1_CLICKUP_2, + BUTTON1_CLICKUP_OTHER, BUTTON1_LONGPRESS_1S, BUTTON1_LONGPRESS_2S, BUTTON1_LONGPRESS_3S, -- 2.17.1