feat(voice): add on-device Miao Zhang Gui wake word

Add an optional local wake response prompt configuration. The prompt asset is intentionally not included yet.
This commit is contained in:
chenjintao
2026-08-10 16:54:42 +08:00
parent d9660164a6
commit e5c1564130
21 changed files with 2010 additions and 56 deletions
@@ -88,6 +88,10 @@
#define CONFIG_TQ_PTT_CLICK_CAPTURE_TIMEOUT_MS 8000
#endif
#ifndef CONFIG_TQ_LOCAL_WAKE_STOP_WAIT_MS
#define CONFIG_TQ_LOCAL_WAKE_STOP_WAIT_MS 1000
#endif
#ifndef CONFIG_TQ_NETWORK_TASK_CORE
#define CONFIG_TQ_NETWORK_TASK_CORE 0
#endif
@@ -303,6 +307,9 @@ static void control_plane_notify_wifi_state_task(void)
void control_plane_set_ptt_active(bool active)
{
if (active) {
control_plane_local_wake_pause_for_foreground();
}
bool notify_worker = false;
ptt_state_t old_state = PTT_STATE_IDLE;
ptt_state_t new_state = PTT_STATE_IDLE;
@@ -356,6 +363,20 @@ void control_plane_set_ptt_active(bool active)
if (notify_worker) {
control_plane_notify_wifi_state_task();
}
if (!active) {
control_plane_local_wake_resume_after_foreground();
}
}
bool control_plane_voice_turn_is_idle(void)
{
bool idle = false;
portENTER_CRITICAL(&s_runtime_lock);
idle = s_ptt_runtime.state == PTT_STATE_IDLE &&
!s_ptt_runtime.active &&
!s_ptt_runtime.pending_press_after_teardown;
portEXIT_CRITICAL(&s_runtime_lock);
return idle;
}
static bool control_plane_get_ptt_active(void)
@@ -1880,6 +1901,15 @@ esp_err_t control_plane_start_runtime_workers(void)
return key_input_err;
}
esp_err_t local_wake_err = control_plane_local_wake_start();
if (local_wake_err != ESP_OK) {
ESP_LOGE(TAG,
"Start local wake worker failed: %s",
esp_err_to_name(local_wake_err));
control_plane_stop_runtime_workers();
return local_wake_err;
}
esp_err_t remote_log_err = control_plane_remote_log_start();
if (remote_log_err != ESP_OK && remote_log_err != ESP_ERR_NOT_SUPPORTED) {
ESP_LOGW(TAG, "Remote log start failed: %s", esp_err_to_name(remote_log_err));
@@ -1946,6 +1976,7 @@ void control_plane_stop_runtime_workers(void)
{
control_plane_set_runtime_stop_requested(true);
control_plane_stop_user_config_server();
(void)control_plane_local_wake_stop(CONFIG_TQ_LOCAL_WAKE_STOP_WAIT_MS);
#if CONFIG_TQ_FACTORY_CLI_ENABLE
control_plane_factory_cli_stop();