增加了单击启动对话和长按期间对话,默认使用短按启动对话

This commit is contained in:
CSBOOK\44744
2026-07-02 14:02:51 +08:00
parent bc74db61a9
commit 404389f1ea
6 changed files with 104 additions and 77 deletions
@@ -30,6 +30,10 @@
#define CONFIG_TQ_SYSTEM_EVENT_TASK_STACK 4096
#endif
#if !defined(CONFIG_TQ_PTT_MODE_HOLD_TO_TALK) && !defined(CONFIG_TQ_PTT_MODE_CLICK_TO_TALK)
#define CONFIG_TQ_PTT_MODE_CLICK_TO_TALK 1
#endif
#define CONTROL_PLANE_PTT_HOLD_STEP_MS 80
#ifndef CONFIG_TQ_LOCAL_TASK_CORE
@@ -153,12 +157,32 @@ static void control_plane_dispatch_key_event(const control_plane_key_event_t *ev
switch (event->type) {
case CONTROL_PLANE_KEY_EVENT_PRESSED: {
#if CONFIG_TQ_PTT_MODE_CLICK_TO_TALK
control_plane_multimodal_runtime_state_t state = {0};
if (control_plane_multimodal_get_runtime_state(&state) == ESP_OK &&
state.remote_responding) {
esp_err_t err = control_plane_multimodal_send_request_to_speak();
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
ESP_LOGW(TAG, "PTT barge-in request failed: %s", esp_err_to_name(err));
}
}
#else
control_plane_set_ptt_active(true);
#endif
break;
}
case CONTROL_PLANE_KEY_EVENT_RELEASED: {
#if !CONFIG_TQ_PTT_MODE_CLICK_TO_TALK
control_plane_set_ptt_active(false);
#endif
break;
}
case CONTROL_PLANE_KEY_EVENT_SHORT_PRESS: {
#if CONFIG_TQ_PTT_MODE_CLICK_TO_TALK
control_plane_set_ptt_active(true);
#endif
break;
}