forked from xiaozhi/xiaozhi-esp32
fix xmini-c3 toggle state
This commit is contained in:
@@ -85,7 +85,9 @@ void Application::CheckNewVersion() {
|
|||||||
wake_word_detect_.StopDetection();
|
wake_word_detect_.StopDetection();
|
||||||
#endif
|
#endif
|
||||||
// 预先关闭音频输出,避免升级过程有音频操作
|
// 预先关闭音频输出,避免升级过程有音频操作
|
||||||
board.GetAudioCodec()->EnableOutput(false);
|
auto codec = board.GetAudioCodec();
|
||||||
|
codec->EnableInput(false);
|
||||||
|
codec->EnableOutput(false);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
audio_decode_queue_.clear();
|
audio_decode_queue_.clear();
|
||||||
@@ -479,7 +481,6 @@ void Application::ResetDecoder() {
|
|||||||
opus_decoder_->ResetState();
|
opus_decoder_->ResetState();
|
||||||
audio_decode_queue_.clear();
|
audio_decode_queue_.clear();
|
||||||
last_output_time_ = std::chrono::steady_clock::now();
|
last_output_time_ = std::chrono::steady_clock::now();
|
||||||
Board::GetInstance().GetAudioCodec()->EnableOutput(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::OutputAudio() {
|
void Application::OutputAudio() {
|
||||||
@@ -598,8 +599,10 @@ void Application::SetDeviceState(DeviceState state) {
|
|||||||
// The state is changed, wait for all background tasks to finish
|
// The state is changed, wait for all background tasks to finish
|
||||||
background_task_->WaitForCompletion();
|
background_task_->WaitForCompletion();
|
||||||
|
|
||||||
auto display = Board::GetInstance().GetDisplay();
|
auto& board = Board::GetInstance();
|
||||||
auto led = Board::GetInstance().GetLed();
|
auto codec = board.GetAudioCodec();
|
||||||
|
auto display = board.GetDisplay();
|
||||||
|
auto led = board.GetLed();
|
||||||
led->OnStateChanged();
|
led->OnStateChanged();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case kDeviceStateUnknown:
|
case kDeviceStateUnknown:
|
||||||
@@ -626,6 +629,7 @@ void Application::SetDeviceState(DeviceState state) {
|
|||||||
case kDeviceStateSpeaking:
|
case kDeviceStateSpeaking:
|
||||||
display->SetStatus("说话中...");
|
display->SetStatus("说话中...");
|
||||||
ResetDecoder();
|
ResetDecoder();
|
||||||
|
codec->EnableOutput(true);
|
||||||
#if CONFIG_USE_AUDIO_PROCESSING
|
#if CONFIG_USE_AUDIO_PROCESSING
|
||||||
audio_processor_.Stop();
|
audio_processor_.Stop();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ private:
|
|||||||
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
|
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
|
||||||
ResetWifiConfiguration();
|
ResetWifiConfiguration();
|
||||||
}
|
}
|
||||||
app.ToggleChatState();
|
|
||||||
});
|
});
|
||||||
boot_button_.OnPressDown([this]() {
|
boot_button_.OnPressDown([this]() {
|
||||||
Application::GetInstance().StartListening();
|
Application::GetInstance().StartListening();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
|
|||||||
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
|
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
|
||||||
|
|
||||||
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
|
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
|
||||||
|
CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=n
|
||||||
CONFIG_ESP_WIFI_IRAM_OPT=n
|
CONFIG_ESP_WIFI_IRAM_OPT=n
|
||||||
CONFIG_ESP_WIFI_RX_IRAM_OPT=n
|
CONFIG_ESP_WIFI_RX_IRAM_OPT=n
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user