From: SnickerSun Date: Thu, 3 Oct 2024 11:56:11 +0000 (+0800) Subject: 添加 BUTTON1_CLICKUP_OTHER 事件 function连续按8次触发。 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e71f9349cda8ad08d6b6d7e23a5411a3a3b7fd73;p=mirrors%2FFD230.git 添加 BUTTON1_CLICKUP_OTHER 事件 function连续按8次触发。 --- 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,