From: luozheng <1732036298@qq.com> Date: Fri, 25 Jul 2025 09:39:13 +0000 (+0800) Subject: 1.优化pbuf死机,还需多加测试 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F2012%2Ftarget%2F1;p=mirrors%2FFD230.git 1.优化pbuf死机,还需多加测试 2.优化聆听界面切换逻辑 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h index ffa79fd35..4b3a568af 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h @@ -158,6 +158,11 @@ namespace OHOS bool is_need_to_jump_result_view(void); + bool get_is_delay_start_asr(); + void set_is_delay_start_asr(bool); + + bool getentryTextViewState(void); + private: AiVoiceModel(); ~AiVoiceModel(); @@ -191,6 +196,8 @@ namespace OHOS bool AI_BT_state{false}; //蓝牙连接状态 bool init_4gai_task{false}; //4g服务器连接状态 uint8_t select4gorbt{-1}; //0:4g 1:蓝牙 -1:未连接 + + bool is_delay_start_asr{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index 12880bdda..bad87f659 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -172,6 +172,7 @@ namespace OHOS if (GetSelect4gorbt() == AI_SELECT_4G) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSelect4gorbt() == AI_SELECT_4G"); +#if 1 if (GetInit_4gai_task()) { uapi_UI_start_asr(GetCurUsing4GAiModelType()); @@ -180,6 +181,7 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "init_4gai_task fail!!"); } +#endif } else if (GetSelect4gorbt() == AI_SELECT_BT) { @@ -1426,6 +1428,34 @@ namespace OHOS } } } +#if 0 + else + { + if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSelect4gorbt() == AI_SELECT_4G"); + if (AiVoiceModel::GetInstance().GetInit_4gai_task()) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "111:%d",AiVoiceModel::GetInstance().get_is_delay_start_asr()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "222:%d",get_ai_asr_service_init_flag()); + if (!AiVoiceModel::GetInstance().get_is_delay_start_asr()) + { + if (get_ai_asr_service_init_flag() == 0) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "发送查询"); + uapi_UI_start_asr(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); + AI_IS_READY_TIMEOUT = 5; + AiVoiceModel::GetInstance().set_is_delay_start_asr(true); + } + else + { + usleep(10000); + } + } + } + } + } +#endif return; } static void AI_IS_READY_Callback(int data) @@ -1444,6 +1474,9 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer already exists!!"); return; } +#if 0 + AiVoiceModel::GetInstance().set_is_delay_start_asr(false); +#endif /* --------------------------------- 2.创建定时器 -------------------------------- */ g_ai_is_ready_Handle = osTimerNew((osTimerFunc_t)AI_IS_READY_Callback, osTimerPeriodic, nullptr, nullptr); // 检查定时器创建是否成功 @@ -1803,7 +1836,8 @@ namespace OHOS uint8_t asr_state = 0; uint8_t chat_state = 0; uint8_t tts_state = 0; - asr_state = get_ai_asr_service_init_flag(); + // asr_state = get_ai_asr_service_init_flag(); + asr_state = 1; chat_state = get_ai_chat_service_init_flag(); tts_state = get_ai_tts_server_init_flag(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "asr_state:%d,chat_state:%d,tts_state:%d", asr_state, chat_state, tts_state); @@ -1842,6 +1876,21 @@ namespace OHOS return true; } + bool AiVoiceModel::get_is_delay_start_asr() + { + return is_delay_start_asr; + } + + void AiVoiceModel::set_is_delay_start_asr(bool val) + { + is_delay_start_asr = val; + } + + bool AiVoiceModel::getentryTextViewState(void) + { + return entryTextViewState; + } + /*获取已选择的ai模型的textid*/ int AiVoiceModel::GetAiModelTextId() { diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 7bb3fcfeb..be9d5d28e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -150,6 +150,7 @@ namespace OHOS { if (view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID) || view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "JumpToReturnResultTextView"); ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_RETURN_RESULT_TEXT_VIEWID); } else @@ -568,7 +569,8 @@ namespace OHOS { uapi_UI_stop_asr(); usleep(10000); - if (!model->is_need_to_jump_result_view()) // 没有数据就跳转到思考中界面 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FINISH_SPEAKING_BUTTON_VIEW_ID:(%d,%d)",model->is_need_to_jump_result_view(),model->getentryTextViewState()); + if (!model->is_need_to_jump_result_view() && !model->getentryTextViewState()) // 没有数据就跳转到思考中界面 { ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp index 9d22b9507..51efc050e 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp @@ -374,7 +374,7 @@ static uint8_t ai_tts_server_init_flag = 0; //tts初始化标志 // 获取ASR服务初始化标志 uint8_t get_ai_asr_service_init_flag(void) { - return true; + return ai_asr_service_init_flag; } // 设置ASR服务初始化标志 diff --git a/code/sdk/open_source/openharmony/third_party/lwip/src/core/pbuf.c b/code/sdk/open_source/openharmony/third_party/lwip/src/core/pbuf.c index 7638dfda8..dcfbd386a 100644 --- a/code/sdk/open_source/openharmony/third_party/lwip/src/core/pbuf.c +++ b/code/sdk/open_source/openharmony/third_party/lwip/src/core/pbuf.c @@ -751,6 +751,8 @@ pbuf_free(struct pbuf *p) SYS_ARCH_PROTECT(old_level); /* all pbufs in a chain are referenced at least once */ LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); + if(p->ref <=0) + return 0; /* decrease reference count (number of pointers to pbuf) */ ref = --(p->ref); SYS_ARCH_UNPROTECT(old_level);