From cc0df5a81976adcb627b872676d2009ae02dd201 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Sat, 31 Aug 2024 09:20:59 +0000 Subject: [PATCH] Merge #847 into sdk602patch0626 from refs/changes/847/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 优化离线语音助手内存泄漏 * refs/changes/847/head: (2 commits squashed) - 优化离线语音助手内存泄漏 - 修复BUG 550 “运动,心率显示,刚开始每次心率都是一样的,实际心率灯没测量 ,将绝对静止判断时间调整为90分钟 Signed-off-by: aliyun6865282430 <1624952103@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/847 --- .../nativeui/offlinevoice/src/VocassistView.cpp | 13 +++++++++++-- code/sdk/drivers/peripheral/cywee/src/main_dml.c | 15 ++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp b/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp index ab6637dd5..3991d2184 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp @@ -13,6 +13,7 @@ #include "VocassistModel.h" #include "VocassistView.h" #include "VocassistPresenter.h" +#include "uicomponents/UIComponents.h" static constexpr uint16_t SWITCH_MAP_NUM = 16; static constexpr uint16_t ANI_X = 84; @@ -147,6 +148,14 @@ VoiceAssistance::~VoiceAssistance() callwordContext = nullptr; delete workFrame; workFrame = nullptr; + + (void)memset_s(storPicPathBuf, sizeof(storPicPathBuf), 0, sizeof(storPicPathBuf)); + for (int i = 0; i < ANI_TOTAL_NUM; i++) { + sprintf_s(storPicPathBuf[i], sizeof(storPicPathBuf[i]), + RES_PATH"/VOICE_ASSISTANT_%02d.bin", i + 1); + ImageCacheManager::GetInstance().UnloadSingleRes((const char *)storPicPathBuf[i]); + + } } VoiceAssistance *VoiceAssistance::GetInstance() @@ -165,12 +174,12 @@ void VoiceAssistance::InitImageAnimatorSource(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Splice failed!!"); return; } - imageAnimatorInfo[i].imagePath = (const char *)storPicPathBuf[i]; + imageAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes((const char *)storPicPathBuf[i]); imageAnimatorInfo[i].pos.x = ANI_X; imageAnimatorInfo[i].pos.y = ANI_Y; imageAnimatorInfo[i].width = ANI_SL; imageAnimatorInfo[i].height = ANI_SL; - imageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + imageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceAssistView] VoiceAssistanceInitImageAnimatorSource success!!"); } diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 83ede1d48..364b37393 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -96,10 +96,10 @@ int cm__hs1__deinit(void); void cywee_set_abs_static(void) { - int time = get_config_heart_from_config_model(); + //int time = get_config_heart_from_config_model(); memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; - scl.iData[1] = time * 60; + scl.iData[1] = 90 * 60; CWM_SettingControl(SCL_ABS_STATIC_CONFIG, &scl); } @@ -470,9 +470,8 @@ void cywee_wearstatus_update(int wearstatus) if(is_abs_static_state == 1) { wearstatus = 0; + is_abs_static_state = 0; } - is_abs_static_state = 0; - memset(&csd, 0, sizeof(CUSTOM_OFFBODY_DETECT)); csd.sensorType = CUSTOM_OFFBODY_DETECT; csd.fData[0] = wearstatus; @@ -781,6 +780,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); hrs_mode_state = 1; + hrs = 0;//运动开始,清零心率 } else { @@ -916,7 +916,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { c_activity_result_t.duration = (int)sensorEVT->fData[5]; c_activity_result_t.MHR_zone = (int)sensorEVT->fData[6]; c_activity_result_t.hrs = hrs; - + hrs = 0; //每次上报完 清除心率值 cywee_func(CYWEE_MSG_TYPE_ACTIVITY_UPDATE,&c_activity_result_t,sizeof(cywee_activity_result_t)); }else if((int)sensorEVT->fData[0] == 102) @@ -936,6 +936,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { c_activity_result_t.step_length = (float)sensorEVT->fData[6]; c_activity_result_t.pace = (int)sensorEVT->fData[7]; c_activity_result_t.hrs = hrs; + hrs = 0; //每次上报完 清除心率值 cywee_func(CYWEE_MSG_TYPE_ACTIVITY_UPDATE,&c_activity_result_t,sizeof(cywee_activity_result_t)); CustomEventPublish(TOPIC_EVENT_STEPDATA_UPDATE,&stepcount,sizeof(int)); } @@ -1244,8 +1245,8 @@ int cywee_main_dml(void) // CWM_Sensor_Enable(IDX_GYRO); CWM_Sensor_Enable(IDX_ALGO_NO_MOTION); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTIOIN); - //CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); + // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTION); + CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); cywee_restoreData(); -- 2.17.1