From 34dc22c24aa037316d880b94eee50095bffb420b Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Sat, 17 Aug 2024 18:14:24 +0800 Subject: [PATCH] =?utf8?q?=E7=9D=A1=E7=9C=A0=E6=A8=A1=E5=BC=8F=E5=8A=A0?= =?utf8?q?=E5=85=A5=E7=BB=9D=E5=AF=B9=E9=9D=99=E6=AD=A2=E5=88=A4=E6=96=AD?= =?utf8?q?=20=E4=BC=98=E5=8C=96=E8=BF=90=E5=8A=A8=E6=95=B0=E6=8D=AE?= =?utf8?q?=E8=8E=B7=E5=8F=96=E4=BF=9D=E5=AD=98=20=E4=BC=98=E5=8C=96?= =?utf8?q?=E7=9C=81=E7=94=B5=E6=A8=A1=E5=BC=8F=E9=80=BB=E8=BE=91=EF=BC=8C?= =?utf8?q?=E6=B7=BB=E5=8A=A0=E8=BF=90=E5=8A=A8=E8=AF=86=E5=88=AB=E5=BC=80?= =?utf8?q?=E5=85=B3=20=E4=BC=98=E5=8C=96=E5=BF=83=E7=8E=87=E8=A1=80?= =?utf8?q?=E6=B0=A7slice=E8=8E=B7=E5=8F=96=E4=BD=A9=E6=88=B4=E7=8A=B6?= =?utf8?q?=E6=80=81=EF=BC=8C=E5=8A=A0=E5=A4=A7unwear=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../bloodoxygen/src/BloodOxygenModel.cpp | 2 +- .../nativeui/heartrate/src/HeartModel.cpp | 2 +- .../src/MotionRecognitionPresenter.cpp | 5 +- .../nativeui/traing/src/TraingModel.cpp | 7 ++- .../msg_center/src/msg_center_customer.cpp | 56 +++++++++++++------ .../peripheral/config/include/ConfigModelC.h | 3 +- .../peripheral/config/src/ConfigModel.cpp | 9 +++ .../drivers/peripheral/cywee/Inc/cywee_hal.h | 2 +- .../drivers/peripheral/cywee/src/main_dml.c | 33 +++++++++-- .../drivers/peripheral/ppg/hx3695/hx3695.c | 26 +++++---- .../drivers/peripheral/ppg/hx3695/hx3695.h | 2 +- .../peripheral/ppg/hx3695/hx3695_hal.c | 4 +- .../drivers/peripheral/utils/custom_runtime.c | 11 ++++ .../drivers/peripheral/utils/custom_runtime.h | 4 ++ .../drivers/peripheral/utils/custom_utils.c | 24 ++++++-- 15 files changed, 139 insertions(+), 51 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp index 25ff1c43b..c6cf4d21d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp @@ -14,7 +14,7 @@ extern "C" errcode_t uapi_get_timestamp_ms(uint32_t *tm); #include "NativeAbility.h" #include "battery_hal.h" -#define MAX_UNWARE_COUNT 20 +#define MAX_UNWARE_COUNT 30 #define MAX_VALID_SPO2_COUNT 30 #define MAX_DISVALID_SPO2_COUNT 100 namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp index d011c80b3..092e9e6c6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -29,7 +29,7 @@ extern "C" { #endif -#define MAX_UNWEAR_COUNT 20 +#define MAX_UNWEAR_COUNT 30 #define MAX_VALID_HRS_COUNT 40 #define MAX_DISVALID_HRS_COUNT 70 #define HEARTTEST 1 //[0 开启测试 1 关闭] diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp index 846cfcc71..09d26a794 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-28 14:17:43 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-07-26 10:02:53 + * @LastEditTime: 2024-08-17 17:04:07 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp */ #include "AppViewIDs.h" @@ -14,6 +14,7 @@ #include "ConfigModel.h" #include #include "cywee_service.h" +#include "custom_runtime.h" namespace OHOS { @@ -101,11 +102,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OPEN_AR_ALERT,NULL); ConfigModel::GetInstance()->SetMotionRecognition(true); + uapi_dev_runtime_set_motion_recognition_status(1); break; case UICheckBox::UNSELECTED: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CLOSE_AR_ALERT,NULL); ConfigModel::GetInstance()->SetMotionRecognition(false); + uapi_dev_runtime_set_motion_recognition_status(0); break; default: break; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index ae2dd7370..b7ecf8a0f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -483,8 +483,9 @@ namespace OHOS sportdata->distance = cyweeInfo->distance; sportdata->calories = cyweeInfo->calories; - sportdata->cdc = cyweeInfo->step_frequency; - sportdata->std = cyweeInfo->step_length; + // sportdata->cdc = cyweeInfo->step_frequency; + // sportdata->std = cyweeInfo->step_length; + sportdata->pc = cyweeInfo->pace; // 更新最慢配速 @@ -553,6 +554,8 @@ namespace OHOS { sportdata->apc = cyweeInfo->avg_pace; sportdata->fpc = cyweeInfo->max_pace; + sportdata->cdc = cyweeInfo->avg_step_freq; + sportdata->std = cyweeInfo->avg_step_len; } /*打印函数*/ diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index b3865869d..67f9632cc 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -1076,32 +1076,31 @@ void MsgCenterNotifyActivityProc(const Topic topic, Request* req) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_t failed, ret = %d", rets); return; } - - /*更新卡路里数据*/ - if(c_activity_result_t->calories!=0) + if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_NORMAL) { - set_calories_data(c_activity_result_t->calories); + /*更新卡路里数据*/ + if(c_activity_result_t->calories!=0) + { + set_calories_data(c_activity_result_t->calories); #if DIALDATASET - DialModelCalorie::GetInstance()->UpdateCalorie(get_calories_data()); + DialModelCalorie::GetInstance()->UpdateCalorie(get_calories_data()); #endif - } - - - /*更新距离数据*/ - if(c_activity_result_t->distance!=0) - { - set_distance_data(c_activity_result_t->distance); + } + /*更新距离数据*/ + if(c_activity_result_t->distance!=0) + { + set_distance_data(c_activity_result_t->distance); #if DIALDATASET - DialModelDistance::GetInstance()->UpdateDistance(get_distance_data()); + DialModelDistance::GetInstance()->UpdateDistance(get_distance_data()); #endif + } } - - /*更新卡路里数据*/ - if(c_activity_result_t->MHR_zone>=2) + else if(c_activity_result_t->activity_mode == SPORT_ACTIVE_MODE_FREE_TRAINING && c_activity_result_t->MHR_zone >= 2) { - set_fat_time_data(); + /*更新燃脂时间数据*/ + set_fat_time_data(1); } - + free(c_activity_result_t); c_activity_result_t = NULL; } @@ -1109,6 +1108,27 @@ void MsgCenterNotifyActivityProc(const Topic topic, Request* req) void MsgCenterNotifyActivityExtraInfoProc(const Topic topic, Request* req) { unused(topic); + cywee_activity_result_extre_info_t* c_activity_result_extre_info_t = (cywee_activity_result_extre_info_t *) malloc(req->len); + if(c_activity_result_extre_info_t==NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Memory allocation failure"); + return; + } + + int rets = memcpy_s(c_activity_result_extre_info_t, req->len, (cywee_activity_result_extre_info_t*)req->data, req->len); + if (rets != EOK) + { + free(c_activity_result_extre_info_t); + c_activity_result_extre_info_t = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s c_activity_result_extre_info_t failed, ret = %d", rets); + return; + } + + /*更新燃脂时间数据*/ + set_fat_time_data(c_activity_result_extre_info_t->ativity_zone_high_duration); + + free(c_activity_result_extre_info_t); + c_activity_result_extre_info_t = NULL; } void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h index 6ab78b721..24e0c5881 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-17 09:32:03 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-08-15 18:23:37 + * @LastEditTime: 2024-08-17 10:47:17 * @FilePath: /FD230/code/sdk/drivers/peripheral/config/include/ConfigModelC.h */ #ifndef _CONFIG_MODEL_C_H_ @@ -108,6 +108,7 @@ int get_sedentary_switch_from_config_model(void); int get_sedentary_time_from_config_model(void); int get_sedentary_interval_from_config_model(void); bool get_motion_recognition_from_config_model(void); +int get_config_heart_from_config_model(void); //设置睡眠频率 void set_config_heart(int heartRateDetectionFreq); diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index 87bc8892d..8c7103216 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -1519,6 +1519,15 @@ void set_config_heart(int heartRateDetectionFreq) // 设置心率检测频率 OHOS::ConfigModel::GetInstance()->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_DETECTED, heartRateDetectionFreq); } + +// 获取心率检测周期 +int get_config_heart_from_config_model(void) +{ + int time = 0; + time = OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_DETECTED); + return time; +} + //获取久坐提醒开关 int get_sedentary_switch_from_config_model(void) { diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 079defc50..51a086467 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -552,7 +552,7 @@ int get_calories_data(void); void set_distance_data(uint32_t data); int get_distance_data(void ); -void set_fat_time_data(void); +void set_fat_time_data(int time); int get_fat_time_data(void); void cywee_get_chipinfo(char *databuf,uint8_t len); diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 12d67443d..debf88b77 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -78,9 +78,21 @@ static uint8_t is_static_state = 0; uint8_t cywee_ble_service_flag = 0; +static uint8_t is_abs_static_state = 0; + int cm__hs1__init(void); int cm__hs1__deinit(void); + +void cywee_set_abs_static(void) +{ + int time = get_config_heart_from_config_model(); + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = time * 60; + CWM_SettingControl(SCL_ABS_STATIC_CONFIG, &scl); +} + void cywee_log_switch(int cmd) { if(cmd) @@ -232,9 +244,9 @@ int get_distance_data(void ) return new_distance+history_distances; } -void set_fat_time_data(void) +void set_fat_time_data(int time) { - new_fat++; + new_fat += time; } int get_fat_time_data(void) @@ -440,11 +452,17 @@ void cywee_oncharging_update(int oncharging_status) void cywee_wearstatus_update(int wearstatus) { - CWM_OS_dbgPrintf("111wearstatus : %d\r\n",wearstatus); + if(is_abs_static_state == 1) + { + wearstatus = 0; + } + is_abs_static_state = 0; + memset(&csd, 0, sizeof(CUSTOM_OFFBODY_DETECT)); csd.sensorType = CUSTOM_OFFBODY_DETECT; csd.fData[0] = wearstatus; CWM_CustomSensorInput(&csd); + CWM_OS_dbgPrintf("111wearstatus : %d\r\n",wearstatus); } //0:resume , 1:pause @@ -913,6 +931,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { break; case IDX_ALGO_ABSOLUTE_STATIC: CWM_OS_dbgPrintf("IDX_ALGO_ABSOLUTE_STATIC\n"); + is_abs_static_state = 1; break; case IDX_ALGO_SPV: CWM_OS_dbgPrintf("IDX_ALGO_SPV\n"); @@ -1165,6 +1184,9 @@ int cywee_main_dml(void) //设置运动识别 cywee_ar_alert_switch(get_motion_recognition_from_config_model()); + //设置绝对静止 + cywee_set_abs_static(); + //呼叫任一個CWM_Sensor_Enable 前呼叫此指令 设置手动或自动模式 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; @@ -1187,15 +1209,14 @@ int cywee_main_dml(void) 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_ABSOLUTE_STATIC); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); cywee_restoreData(); cywee_set_user_info(); cywee_activity_mode_change(SPORT_ACTIVE_MODE_NORMAL); - - cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP); + //cywee_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP); //cywee_inactivity_mode_change(INACTIVITY_MODE_SLEEPING); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 41326e17d..fb706a58a 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -124,7 +124,7 @@ uint8_t alg_ram[11 * 1024] __attribute__((aligned(4))); ppg_sensor_data_t ppg_s_data; static int cywee_data = 0; -int wear_mode_status = -1; +static int wear_status = -1; static uint8_t hx3695_chip_id = 0; @@ -2718,8 +2718,7 @@ static void get_avg_hrs(int32_t hrs) func(HX3695_MSG_TYPE_STATIC_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); } } - //if(hrs_mode_state) - if(hrs_mode_state || uapi_dev_runtime_get_sleep_status() == 1) + if(hrs_mode_state) { cywee_data = hrsresult.lastesthrs; do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); @@ -2728,14 +2727,19 @@ static void get_avg_hrs(int32_t hrs) } -void hx3695_wearstatus_update(void) +void hx3695_hrs_wearstatus_update(void) { - if(wear_mode_status != hrsresult.wearstatus) + if(wear_status != hrsresult.wearstatus) { - wear_mode_status = hrsresult.wearstatus; - cywee_data = wear_mode_status; + wear_status = hrsresult.wearstatus; + cywee_data = wear_status; do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); } + if(wear_status) + cywee_data = hrsresult.lastesthrs; + else + cywee_data = 0; + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); } #ifdef HRS_ALG_LIB @@ -2848,7 +2852,7 @@ void hx3695_hrs_ppg_Int_handle(void) } //PRINT("hxdata:%d/%d %d %d %.3f %.3f %.3f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsen_fifo_x_send[ii],gsen_fifo_y_send[ii],gsen_fifo_z_send[ii],ppg_s_data.green_cur); //PRINT("hxdata:%d/%d %d %d %d %d %d %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsen_fifo_x_send[ii],gsen_fifo_y_send[ii],gsen_fifo_z_send[ii],ppg_s_data.green_cur); - PRINT("hxdata:%d/%d %d %d %.3f %.3f %.3f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsensordata[ii].x,gsensordata[ii].y,gsensordata[ii].z,ppg_s_data.green_cur); + //PRINT("hxdata:%d/%d %d %d %.3f %.3f %.3f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsensordata[ii].x,gsensordata[ii].y,gsensordata[ii].z,ppg_s_data.green_cur); } hrs_wear_status = hx3695_hrs_get_wear_status(); @@ -3668,10 +3672,10 @@ void hx3695_wear_ppg_Int_handle(void) hx3695_check_touch_read(&ppg_s_data); hx3695_wear_status = hx3695_check_touch_send_data(ir_buf,*count); // PRINT("hx3695_wear_status : %d \r\n",hx3695_wear_status); - if(wear_mode_status != hx3695_wear_status) + if(wear_status != hx3695_wear_status) { - wear_mode_status = hx3695_wear_status; - cywee_data = wear_mode_status; + wear_status = hx3695_wear_status; + cywee_data = wear_status; do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); } diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h index d16717132..bf2d8d59b 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h @@ -297,7 +297,7 @@ void agc_timeout_handler(void * p_context); void heart_rate_meas_timeout_handler(void * p_context); void wear_mode_timeout_handler(void * p_context); void Efuse_Mode_Check(void); -void hx3695_wearstatus_update(void); +void hx3695_hrs_wearstatus_update(void); #include "hx3695_hal.h" #endif diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c index ff1594600..b0d032ceb 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-13 15:08:38 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-08-14 09:48:59 + * @LastEditTime: 2024-08-17 11:11:47 * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.c * @Description: * @@ -76,7 +76,7 @@ void ppg_send_cmd_to_driver(char* mode, uint8_t enable) { #ifdef HRS_ALG_LIB hx3695_hrs_disable(); - hx3695_wearstatus_update(); + hx3695_hrs_wearstatus_update(); #endif }else if(md == HRV_MODE) { diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index 2f915d733..b0aa8b88b 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -75,6 +75,7 @@ typedef struct uint8_t drinkremind_status; uint8_t train_status;//训练状态 uint8_t saveele_status;//省电模式状态 + uint8_t motion_recognition_status;//运动识别开关状态 } runtime_status_t; @@ -339,4 +340,14 @@ void uapi_dev_runtime_set_saveele_status(uint8_t status) uint8_t uapi_dev_runtime_get_saveele_status(void) { return g_runtime.saveele_status; +} + +/*设置运动识别状态*/ +void uapi_dev_runtime_set_motion_recognition_status(uint8_t status) +{ + g_runtime.motion_recognition_status = status; +} +uint8_t uapi_dev_runtime_get_motion_recognition_status(void) +{ + return g_runtime.motion_recognition_status; } \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 485fc866b..9684f8f6a 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -71,6 +71,10 @@ uint8_t uapi_dev_runtime_get_train_status(void); void uapi_dev_runtime_set_saveele_status(uint8_t status); uint8_t uapi_dev_runtime_get_saveele_status(void); +/*运动识别*/ +void uapi_dev_runtime_set_motion_recognition_status(uint8_t status); +uint8_t uapi_dev_runtime_get_motion_recognition_status(void); + /***************************************cat1 runtime 变量设置获取函数**************************************************/ diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index bb6e6b375..f320e8b54 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1175,6 +1175,7 @@ void uapi_set4GCapability(bool isopen) if(isopen) { power_on_cat1(); + uapi_dev_runtime_set_cat1_powerstat(1); #ifdef SUPPORT_TCPIP tcp_thread_id = tcp_get_thread_id(); ret = uapi_resume_thread(tcp_thread_id); @@ -1187,6 +1188,7 @@ void uapi_set4GCapability(bool isopen) else { power_off_cat1(); + uapi_dev_runtime_set_cat1_powerstat(0); #ifdef SUPPORT_TCPIP tcp_thread_id = tcp_get_thread_id(); ret = uapi_suspend_thread(tcp_thread_id); @@ -2279,16 +2281,21 @@ void uapi_enter_power_saving_mode(void) uapi_dev_runtime_set_saveele_status(1); //关闭蓝牙 - stop_custom_ble_service(); + if(uapi_dev_runtime_get_bt_powerstat()) + stop_custom_ble_service(); //关闭cat1 - uapi_set4GCapability(false); + if(uapi_dev_runtime_get_cat1_powerstat()) + uapi_set4GCapability(false); + //停止心率周期检测 - //停止心率周期检测(runtime) - //进入normal模式 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NORMAL_MODE,NULL); + //关闭运动识别 + if(uapi_dev_runtime_get_motion_recognition_status()) + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CLOSE_AR_ALERT,NULL); + //关闭音乐 } @@ -2300,13 +2307,18 @@ void uapi_exit_power_saving_mode(void) uapi_dev_runtime_set_saveele_status(0); //打开蓝牙 - start_custom_ble_service(); + if(uapi_dev_runtime_get_bt_powerstat()) + start_custom_ble_service(); //打开cat1 - uapi_set4GCapability(true); + if(uapi_dev_runtime_get_cat1_powerstat()) + uapi_set4GCapability(true); //开启心率周期检测(runtime) + //开启运动识别 + if(uapi_dev_runtime_get_motion_recognition_status()) + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OPEN_AR_ALERT,NULL); } -- 2.17.1