|
|
@@ -402,7 +402,7 @@ void Application::Start() {
|
|
|
return higher_priority_task_woken == pdTRUE;
|
|
|
});
|
|
|
codec->Start();
|
|
|
- codec->SetOutputVolume(100);
|
|
|
+ codec->SetOutputVolume(80);
|
|
|
// //此处是电量测量的代码
|
|
|
// int batteryLevel;
|
|
|
// bool isCharging;
|
|
|
@@ -480,10 +480,11 @@ void Application::Start() {
|
|
|
if (device_state_ == kDeviceStateSpeaking) {
|
|
|
background_task_->WaitForCompletion();
|
|
|
if (keep_listening_) {
|
|
|
+ // ESP_LOGI(TAG, "Stop 后的 Listening");
|
|
|
// protocol_->SendStartListening(kListeningModeAutoStop);
|
|
|
- // SetDeviceState(kDeviceStateListening);
|
|
|
+ SetDeviceState(kDeviceStateListening);
|
|
|
} else {
|
|
|
- // SetDeviceState(kDeviceStateIdle);
|
|
|
+ SetDeviceState(kDeviceStateIdle);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -538,7 +539,7 @@ void Application::Start() {
|
|
|
// vTaskDelete(NULL);
|
|
|
// }, "check_new_version", 4096 * 2, this, 2, nullptr);
|
|
|
SetDeviceState(kDeviceStateIdle);
|
|
|
- codec->SetOutputVolume(100);
|
|
|
+ codec->SetOutputVolume(80);
|
|
|
PlaySound(Lang::Sounds::P3_LINKWIFI);
|
|
|
|
|
|
#if CONFIG_USE_AUDIO_PROCESSOR
|
|
|
@@ -662,10 +663,6 @@ void Application::MainLoop() {
|
|
|
SCHEDULE_EVENT | AUDIO_INPUT_READY_EVENT | AUDIO_OUTPUT_READY_EVENT,
|
|
|
pdTRUE, pdFALSE, portMAX_DELAY);
|
|
|
|
|
|
- //+2 默认开启音频
|
|
|
- // ESP_LOGI("main", "bits1: %lu", bits); // 修改:%d → %lu
|
|
|
- // bits |= (1 << 1);
|
|
|
- // ESP_LOGI("main", "bits2: %lu", bits); // 修改:%d → %lu
|
|
|
if (bits & AUDIO_INPUT_READY_EVENT) {
|
|
|
InputAudio();
|
|
|
}
|
|
|
@@ -830,6 +827,7 @@ void Application::SetDeviceState(DeviceState state) {
|
|
|
display->SetEmotion("neutral");
|
|
|
#if CONFIG_USE_AUDIO_PROCESSOR
|
|
|
audio_processor_.Stop();
|
|
|
+ code_init_flag = false;
|
|
|
#endif
|
|
|
break;
|
|
|
case kDeviceStateConnecting:
|
|
|
@@ -842,7 +840,8 @@ void Application::SetDeviceState(DeviceState state) {
|
|
|
display->SetEmotion("neutral");
|
|
|
ResetDecoder();
|
|
|
// vTaskDelay(pdMS_TO_TICKS(1000));//这里的延迟可以避免音频处理芯片异常时候,导致程序崩溃。但是还是没解决音频异常后的处理。
|
|
|
- if (!lintening_flag_){
|
|
|
+ if (!code_init_flag){
|
|
|
+ code_init_flag = true;
|
|
|
opus_encoder_->ResetState();
|
|
|
#if CONFIG_USE_AUDIO_PROCESSOR
|
|
|
audio_processor_.Start();
|