From e0c9a91dbbd75c3abdb34a72c6b89ffc1a8b07a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Wed, 9 Oct 2024 03:56:15 +0000 Subject: [PATCH] Merge #1133 into sdk602patch0626 from refs/changes/1133/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 彭磊 * refs/changes/1133/head: (18 commits squashed) - 修改小睡数据合并成一个文件 - 修改小睡数据存入一个文件(默认关闭 待协议调通) - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - debug界面添加睡眠数据以及睡眠状态runtime,更新cywee算法库修复配速BUG,优化睡眠模式alarm逻辑 - 修改gsensor FIFO笔数为15笔 并同步运动心率修改 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 回退alarm 睡眠闹钟修改 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 修改心率数据消息为1秒1次,优化省电模式蓝牙开关逻辑 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 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/1133 --- .../nativeui/heartrate/src/HeartModel.cpp | 4 +- .../drivers/peripheral/ppg/hx3695/hx3695.c | 44 +++++++++++-------- .../drivers/peripheral/utils/custom_utils.c | 16 +++---- 3 files changed, 35 insertions(+), 29 deletions(-) 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 b19630152..731e36ea7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -28,11 +28,11 @@ extern "C" { #endif -#define MAX_UNWEAR_COUNT 10 +#define MAX_UNWEAR_COUNT 2 #define MAX_VALID_HRS_COUNT 60 #define MAX_DISVALID_HRS_COUNT 70 #define MIN_DISPLAY_HEART 60 -#define DISPLAY_COUNT 20 +#define DISPLAY_COUNT 0 #define HEARTTEST 1 //[0 开启测试 1 关闭] /*佩戴检测结果*/ diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 2b0e56f83..0a6c890f3 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -45,6 +45,8 @@ int16_t gsen_fifo_z[64]={0}; gsenson_t gsensordata[8]; +static uint8_t msg_count = 0; + #ifdef SPO2_VECTOR #include "spo2_vec.h" uint32_t spo2_send_cnt = 0; @@ -2710,11 +2712,6 @@ static void get_avg_hrs(int32_t hrs) avg_hrs = (sum_hrs - max_hrs - min_hrs) / (hrs_num - 2); //PRINT("max_hrs[%d],min_hrs[%d],avg_hrs[%d]\n",max_hrs,min_hrs,avg_hrs); hrsresult.lastesthrs = avg_hrs; - if(hrs_mode_state) - { - cywee_data = hrsresult.lastesthrs; - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); - } } } @@ -2936,7 +2933,7 @@ void hx3695_hrs_ppg_Int_handle(void) hrsresult.lastesthrs = 0; cywee_wear_status = 0; } - // PRINT("hrsresult.wearstatus : %d , cywee_wear_status : %d , hr_living : %d \n",hrsresult.wearstatus,cywee_wear_status,hrsresult.hr_living); + PRINT("hrsresult.wearstatus : %d , cywee_wear_status : %d , hr_living : %d \n",hrsresult.wearstatus,cywee_wear_status,hrsresult.hr_living); // if(hrs_wear_status == MSG_HRS_WEAR && hrsresult.hr_living == MSG_LIVING_TRUE) // { // if(hrsresult.lastesthrs > 30 && hrsresult.lastesthrs < 220) @@ -2949,23 +2946,32 @@ void hx3695_hrs_ppg_Int_handle(void) // hrsresult.wearstatus = MSG_HRS_NO_WEAR; // hrsresult.lastesthrs = 0; // } - hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); - if(func != NULL) - { - //PRINT("hrsresult.lastesthrs : %d \n",hrsresult.lastesthrs); - func(HX3695_MSG_TYPE_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); - if(uapi_get_cywee_static_state()) - { - func(HX3695_MSG_TYPE_STATIC_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); - } - func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); - } - if(uapi_dev_runtime_get_train_status()) + msg_count++; + if(msg_count == 3) { - hx3695_wearstatus_update(); + msg_count = 0; + hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); + if(func != NULL) + { + PRINT("hrsresult.lastesthrs : %d \n",hrsresult.lastesthrs); + func(HX3695_MSG_TYPE_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + if(uapi_get_cywee_static_state()) + { + func(HX3695_MSG_TYPE_STATIC_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + } + func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + } + + if(uapi_dev_runtime_get_train_status()) + { + hx3695_wearstatus_update(); + cywee_data = hrsresult.lastesthrs; + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); + } } + //PRINT("hx3695 data_cnt: %d, hr_living: %d, hr_living_qu: %d, hr_living_std: %d, hr_result:%d \r\n", //alg_results.data_cnt, hrsresult.hr_living, hrsresult.hr_living_qu, hrsresult.hr_living_std, hrsresult.lastesthrs); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 612385083..5fab00c61 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2383,13 +2383,13 @@ void uapi_enter_power_saving_mode(void) uapi_setScreenBrightness(51); //关闭蓝牙 // if(uapi_dev_runtime_get_bt_powerstat()) - // { - // stop_custom_ble_service(); - // } + { + stop_custom_ble_service(); //一并关闭br + } //断联蓝牙 - uapi_disconnect_remote_device(); + //uapi_disconnect_remote_device(); //关br 保持ble连接 - uapi_close_br_scan(); + //uapi_close_br_scan(); cm_set_HFP_switch(false); @@ -2429,9 +2429,9 @@ void uapi_exit_power_saving_mode(void) uapi_setScreenBrightness(cm_getScreenBrightness()); // //打开蓝牙 - // if(cm_custom_ble_service_on_flag()) - // start_custom_ble_service(); - //开广播 + if(cm_custom_ble_service_on_flag()) + start_custom_ble_service(); + // //开广播 if(cm_custom_ble_service_on_flag()) uapi_open_br_scan(); //打开cat1 -- 2.17.1