From cd2fbf2a25fd8f34831d1462d82f05aa5a2a44b5 Mon Sep 17 00:00:00 2001 From: Terrence Date: Thu, 20 Feb 2025 14:47:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=94=A4=E9=86=92=E8=AF=8D?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/application.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main/application.cc b/main/application.cc index 74c0e1b4..c69e2202 100644 --- a/main/application.cc +++ b/main/application.cc @@ -125,8 +125,14 @@ void Application::CheckNewVersion() { // Activation code is valid SetDeviceState(kDeviceStateActivating); ShowActivationCode(); - // Check again in 60 seconds - vTaskDelay(pdMS_TO_TICKS(60000)); + + // Check again in 60 seconds or until the device is idle + for (int i = 0; i < 60; ++i) { + if (device_state_ == kDeviceStateIdle) { + break; + } + vTaskDelay(pdMS_TO_TICKS(1000)); + } continue; } @@ -488,6 +494,8 @@ void Application::Start() { SetDeviceState(kDeviceStateListening); } else if (device_state_ == kDeviceStateSpeaking) { AbortSpeaking(kAbortReasonWakeWordDetected); + } else if (device_state_ == kDeviceStateActivating) { + SetDeviceState(kDeviceStateIdle); } // Resume detection