From 0ec65de9c96851cb7477990aff643c344a0b3bc9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Thu, 10 Oct 2024 14:01:23 +0000 Subject: [PATCH] Merge #1140 into sdk602patch0626 from refs/changes/1140/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 彭磊 * refs/changes/1140/head: (26 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 - 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 - 修改ble连接参数,降低ble连接功耗 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - br连接以后关闭brscan 降低功耗 - 添加退出省电模式自动回连 - 优化心率检测未佩戴消息上报逻辑并加快上报速度 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/1140 --- .../nativeui/bluetooth/src/BluetoothModel.cpp | 89 +++++++++++-------- .../nativeui/heartrate/include/HeartModel.h | 2 +- .../nativeui/heartrate/src/HeartModel.cpp | 29 +++--- .../service/ble_service/bleservice/bleEvent.c | 1 + .../ble_service/bleservice/bleService.c | 42 ++++++++- .../ble_service/bleservice/bleService.h | 3 + .../msg_center/src/msg_center_customer.cpp | 6 +- .../drivers/peripheral/ppg/hx3695/hx3695.c | 54 +++++++++-- .../drivers/peripheral/ppg/hx3695/hx3695.h | 1 + .../peripheral/ppg/hx3695/hx3695_hrs_agc.c | 17 ++-- .../drivers/peripheral/utils/custom_utils.c | 5 ++ 11 files changed, 177 insertions(+), 72 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index ff8d99574..163416a1e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -791,28 +791,31 @@ void BtGapPairStatusChangedCallback(const bd_addr_t *bdAddr, int status) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtGapPairStatusChangedCallback addr: ****%02x%02x%02x%02x status: %d\n", bdAddr->addr[3], bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0], status); /* addr下标 0 1 2 3 */ - memcpy(&BtGapPair_bdAddr,bdAddr,sizeof(bd_addr_t)); - // if(status == GAP_PAIR_PAIRED) - // { - - - // } - // uapi_a2dp_snk_connect(); - // a2dp_snk_connect(bdAddr); - if(cm_custom_ble_service_on_flag() && !get_ble_pair()&& (status == GAP_PAIR_PAIRED)) + + if ((gap_get_device_class(bdAddr) & 0x200) != 0) { - send_pair_succ((bd_addr_t*)bdAddr); - // if(cm_get_A2DP_switch() || cm_get_HFP_switch()) - // uapi_a2dp_snk_connect(); - hand_watch_first_time_Paired(); - svr_ble_adv_stop(); - //uapi_reconnect(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_a2dp_snk_connect"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtGapPairStatusChangedCallback: Mobile Phone Device"); + if(status==GAP_PAIR_PAIRED) + memcpy(&BtGapPair_bdAddr,bdAddr,sizeof(bd_addr_t)); + + if(cm_custom_ble_service_on_flag() && !get_ble_pair()&& (status == GAP_PAIR_PAIRED)) + { + send_pair_succ((bd_addr_t*)bdAddr); + hand_watch_first_time_Paired(); + svr_ble_adv_stop(); + //uapi_reconnect(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_a2dp_snk_connect"); + } + if(status == GAP_PAIR_PAIRED) + { + set_br_pair(); + } } + if (status == GAP_PAIR_PAIRED) { - set_br_pair(); + if (ConnectPhonePresenter::GetInstance() != nullptr) { NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); } @@ -1059,6 +1062,13 @@ static uint8_t ALC_connect_hfp_flag=0; static uint8_t ALC_connect_A2DP_flag=0; +static bd_addr_t ACL_bdAdd; + +void uapi_set_ACL_br_address(const bd_addr_t * bdAddr) +{ + memcpy(&ACL_bdAdd,bdAddr,sizeof(bd_addr_t)); +} + // 回调:ACL连接状态上报 void GapAclStateChangedCallback(const bd_addr_t *bdAddr, gap_acl_state_t state, unsigned int reason) { @@ -1072,34 +1082,29 @@ void GapAclStateChangedCallback(const bd_addr_t *bdAddr, gap_acl_state_t state, gap_disconnect_remote_device(bdAddr); } - //ALC_State_flag=state; - - // if(ALC_connect_hfp_flag && state==GAP_ACL_STATE_CONNECTED) - // { - // int ret= hfp_hf_connect(bdAddr); - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt hfp_hf_connect ret %X", ret); - // ALC_connect_hfp_flag=0; - // } - - // if(ALC_connect_A2DP_flag && state==1) - // { - // // int ret= hfp_hf_connect(bdAddr); - // // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt hfp_hf_connect ret %X", ret); - // uapi_a2dp_snk_connect(); - // ALC_connect_A2DP_flag=0; - // } - - static bd_addr_t gapAclConnectAddr{0}; /* 连接后保存手机地址,手表清除手机配对后查询不到class比较手机地址 */ - if ((gap_get_device_class(bdAddr) & 0x200) != 0 || memcmp(gapAclConnectAddr.addr, bdAddr->addr, BD_ADDR_LEN) == 0) { + if ((gap_get_device_class(bdAddr) & 0x200) != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback: Mobile Phone Device"); if (state == GAP_ACL_STATE_DISCONNECTED) { /* 通知msg_center,ble状态仍用bt状态,此处不区分 */ SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, nullptr, 0); + + + + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE, 0); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GAP_SCAN_MODE_CONNECTABLE"); + } else if (state == GAP_ACL_STATE_CONNECTED) { (void)memcpy_s(gapAclConnectAddr.addr, BD_ADDR_LEN, bdAddr->addr, BD_ADDR_LEN); SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, nullptr, 0); SendMsgToUIService(BT_CONNECTED_TO_UI, 0, nullptr, 0); + + uapi_set_ACL_br_address(bdAddr); + + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0); + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GAP_SCAN_MODE_NONE"); + } return; } @@ -1447,6 +1452,8 @@ static void BtA2dpSnkConnectStateChangedCb(bd_addr_t *bd_addr, int conn_state) SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, nullptr, 0); SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); } + + } else if (conn_state==PROFILE_STATE_CONNECTING || conn_state==PROFILE_STATE_CONNECTED) { @@ -1571,6 +1578,16 @@ static void sample_gap_scan_mode_changed_callback(int mode) { printf("gap_scan_mode_changed_callback mode: %d\n", mode); + if ((gap_get_device_class(&ACL_bdAdd) & 0x200) != 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sample_gap_scan_mode_changed_callback: Mobile Phone Device"); + if(bt_is_acl_connected(&ACL_bdAdd) && mode!=GAP_SCAN_MODE_NONE) + { + gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0); + } + } + + } void BtInitCallBacks(void) diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h index fb22b4228..f6bb63b87 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h @@ -132,7 +132,7 @@ public: uint32_t GetCheckTime(void); void SetCheckTime(uint32_t time); - void SetWearStatus(int32_t wear); + void SetWearStatus(); void SetResult(HeartResult result); HeartResult GetResult(); 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 5fb49ad60..6ac1cb3ac 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -555,25 +555,15 @@ void HeartModel::Heart_Result() { break; } } -void HeartModel::SetWearStatus(int32_t wear) { - // 设置佩戴状态 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartModel Weartest::%d", wear); - - // 计数更新 - if (wear_ != 1 && wear != 1) { - unwear_counter_++; // 佩戴错误计时器计数 - } else { - unwear_counter_ = 0; // 佩戴正常情况下清零计数器 - } - wear_ = wear; - // 检查是否达到了最大未佩戴计数限制 - if (unwear_counter_ >= MAX_UNWEAR_COUNT) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, - "检测结果:未佩戴计数最大 unwear_counter:%d", unwear_counter_); + void HeartModel::SetWearStatus() + { + // 如果处于训练模式,提前返回 + if (uapi_dev_runtime_get_train_status() == 1) + return; + // 设置佩戴状态 SetResult(HeartResult::NOT_WORN); Heart_Stop(); - } -} + } void HeartModel::UpHeartdata(uint16_t heart) { // 如果处于训练模式,提前返回 @@ -588,6 +578,11 @@ void HeartModel::UpHeartdata(uint16_t heart) { } display_counter_++; } + else + { + displayheart = 0; + } + // 更新心率和计数器 if (displayheart != 0) { diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 9e0c23ca4..b0d9029bc 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -1496,6 +1496,7 @@ void SetUTCtime(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8 sendBuf[17] = set_ok; sendBuf[18] = Calculate_CRC(sendBuf,18); sendBleData(sendBuf,19); + uapi_ble_connect_param_update(50); } else { diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index de9ba2a2c..6e8eec268 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -444,8 +444,7 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl else { devpair_state = 0;// - - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "exit_alipay_gui !!! %d",exit_alipay_gui); + if( g_ble_conn_id !=0 && conn_id!=g_ble_conn_id) { @@ -464,12 +463,33 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl Bleconnect = GAP_BLE_STATE_CONNECTED;//蓝牙已连接 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GAP_BLE_STATE_CONNECTED!!! 0x%x\r\n",pair_state); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GAP_BLE_STATE_CONNECTED!!! 0x%x\r\n",pair_state); + + // gap_conn_param_update_t conn_param = { 0 }; + // conn_param.conn_handle = conn_id; /* param 0: conn_handle */ + // conn_param.interval_min =50; /* param 1: interval_min */ + // conn_param.interval_max = 50; /* param 2: interval_max */ + // conn_param.slave_latency = 6; /* param 3: slave_latency */ + // conn_param.timeout_multiplier = 700; /* param 4: timeout_multiplier */ + // ret = gap_ble_connect_param_update(&conn_param); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap ble update connection parameters ret: %X\n", ret); + } uapi_dev_runtime_set_ble_connect_stat(Bleconnect); } +void uapi_ble_connect_param_update(uint16_t data) +{ + gap_conn_param_update_t conn_param = { 0 }; + conn_param.conn_handle = g_ble_conn_id; /* param 0: conn_handle */ + conn_param.interval_min =data; /* param 1: interval_min */ + conn_param.interval_max = data; /* param 2: interval_max */ + conn_param.slave_latency = 6; /* param 3: slave_latency */ + conn_param.timeout_multiplier = 700; /* param 4: timeout_multiplier */ + int ret = gap_ble_connect_param_update(&conn_param); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap ble update connection parameters ret: %X\n", ret); +} void svr_pair_result_cbt_cb(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) { devpair_state = 1;//代表配对成功了 @@ -526,6 +546,20 @@ void svr_pair_result_cbt_cb(uint16_t conn_id, const bd_addr_t *addr, errcode_t s WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap ble update connection parameters ret: %u\n", ret); } } + // uint16_t interval; /*!< @if Eng interval + // @else 链路调度间隔,单位slot @endif */ + // uint16_t latency; /*!< @if Eng latency + // @else 延迟周期,单位slot @endif */ + // uint16_t timeout; /*!< @if Eng timeout + // @else 超时时间,单位10ms @endif */ +void srv_gap_ble_connect_param_update_callback(uint16_t conn_id, errcode_t status, + const gap_ble_conn_param_update_t *param) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "conn_id %d status %d gap_ble_conn_param_update_t interval %d latency%d timeout %d ",conn_id,status,param->interval,param->latency,param->timeout); +} + + //添加ota特征值 static void srv_ble_add_chart_decr_ota(uint8_t server_id,uint16_t srv_handle) @@ -1395,7 +1429,7 @@ void srv_ble_server_register_gap_ble_callbacks(void)//ble基础通讯服务注 g_ble_gapble_cbs.auth_complete_cb = svr_gap_ble_auth_complete_callback; g_ble_gapble_cbs.start_adv_cb=svr_ble_adv_start_cb; g_ble_gapble_cbs.stop_adv_cb=svr_ble_adv_stop_cb; - + g_ble_gapble_cbs.conn_param_update_cb=srv_gap_ble_connect_param_update_callback; #ifndef SUPPORT_AT_OHOSFWK gap_ble_register_callbacks(&g_ble_gapble_cbs); #else diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h index a830a4b38..84970023f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.h @@ -75,6 +75,9 @@ bool get_ble_adv_status(void); void get_adv_data(char *data); +void uapi_ble_connect_param_update(uint16_t data); + + #ifdef __cplusplus } #endif 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 374f96276..4a8d2f101 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 @@ -834,8 +834,12 @@ void MsgCenterNotifyWearStateProc(const Topic topic, Request* req) if(uapi_dev_runtime_get_train_status()) return; int32_t wear = *((int32_t*)(req->data)); // 进行类型转换 + if(!wear) + { + HeartModel::GetInstance()->SetWearStatus(); + } BloodOxygenModel::GetInstance()->SetWearStatus(wear); - HeartModel::GetInstance()->SetWearStatus(wear); + } } //血氧 diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 0a6c890f3..86223bdaf 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2725,12 +2725,37 @@ void hx3695_wearstatus_update(void) do_cywee_service_check_msg(CYWEE_SERVICE_CMD_WEAR_STATUS_CHANGE,&cywee_data); } } + //脱腕上报未佩戴信息 +void hx3695_unwearstatus_update(void) +{ + hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); + if(func != NULL) + { + hrsresult.lastesthrs = 0; + hrsresult.wearstatus = 0; + + func(HX3695_MSG_TYPE_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()) + { + cywee_wear_status = 0; + hx3695_wearstatus_update(); + cywee_data = 0; + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_HRS_CHANGE,&cywee_data); + } +} + #ifdef HRS_ALG_LIB /*TYHX 心率模式下 读取PPG, 默认320ms*/ hrs_sensor_data_t hrs_s_dat; //hx3695_results_t alg_results_pre; +static uint8_t his_wear = 2; +static uint8_t wear_cnt = 0; + void hx3695_hrs_ppg_Int_handle(void) { uint8_t ii=0; @@ -2933,7 +2958,28 @@ 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); + + + hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); + if(func != NULL) + { + if(his_wear == hrsresult.wearstatus) + { + wear_cnt++; + if(wear_cnt >= 2 && !his_wear) //未佩戴超过2次 上报未佩戴信息 + { + func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + wear_cnt = 0; + } + } + else + { + his_wear = hrsresult.wearstatus; + wear_cnt = 0; + } + } + //PRINT("hrsresult.wearstatus : %d , his_wear : %d , wear_cnt : %d \n",hrsresult.wearstatus,his_wear,wear_cnt); + //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) @@ -2948,19 +2994,17 @@ void hx3695_hrs_ppg_Int_handle(void) // } msg_count++; - if(msg_count == 3) + if(msg_count >= 3) { msg_count = 0; - hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); if(func != NULL) { - PRINT("hrsresult.lastesthrs : %d \n",hrsresult.lastesthrs); + //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()) diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h index d16717132..cd2d55f07 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.h @@ -298,6 +298,7 @@ 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_unwearstatus_update(void); #include "hx3695_hal.h" #endif diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_agc.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_agc.c index 5aafb1c6f..ad21679e2 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_agc.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hrs_agc.c @@ -129,8 +129,7 @@ hrs_wear_msg_code_t hx3695_hrs_wear_mode_check(WORK_MODE_T mode, int32_t infrare { AGC_LOG("run here_low_pow!! \r\n"); hx3695_hrs_low_power(); - - + hx3695_unwearstatus_update();//上报未佩戴信息 } else if(hrs_wear_status_pre == MSG_HRS_WEAR) { @@ -254,11 +253,13 @@ void PPG_hrs_Calibration_Routine(HRS_CAL_SET_T *calR, int32_t g1_led,int32_t g2_ case hrsCalLed: - if(g1_led>900000 && calR->Group1_Ledidac<= 55) + // if(g1_led>900000 && calR->Group1_Ledidac<= 55)//andy + if(g1_led>900000 && calR->Group1_Ledidac<= 115)//andy { calR->Group1_Ledidac = calR->Group1_Ledidac + 6; } - if(g2_led>900000 && calR->Group2_Ledidac<= 55) + // if(g2_led>900000 && calR->Group2_Ledidac<= 55)//andy + if(g2_led>900000 && calR->Group2_Ledidac<= 115)//andy { calR->Group2_Ledidac = calR->Group2_Ledidac + 6; } @@ -371,10 +372,10 @@ void PPG_hrs_Calibration_Routine(HRS_CAL_SET_T *calR, int32_t g1_led,int32_t g2_ default: break; } - AGC_LOG("AGC111: led_drv=%d,ledDac=%d,ambDac=%d,ledstep=%d,rf=%d,state = %d\r\n",\ - calR->Group1_Cur, calR->Group1_Ledidac, calR->Group1_AMBDAC,calR->Group1_step,calR->Group1_RF,calR->state); - AGC_LOG("AGC222: led_drv=%d,ledDac=%d,ambDac=%d,ledstep=%d,rf=%d,state = %d\r\n",\ - calR->Group2_Cur, calR->Group2_Ledidac, calR->Group2_AMBDAC,calR->Group2_step,calR->Group2_RF,calR->state); + AGC_LOG("AGC111: led_drv=%d,ledDac=%d,ambDac=%d,ledstep=%d,rf=%d,state = %d led1=%d\r\n",\ + calR->Group1_Cur, calR->Group1_Ledidac, calR->Group1_AMBDAC,calR->Group1_step,calR->Group1_RF,calR->state,g1_led); + AGC_LOG("AGC222: led_drv=%d,ledDac=%d,ambDac=%d,ledstep=%d,rf=%d,state = %d led2=%d\r\n",\ + calR->Group2_Cur, calR->Group2_Ledidac, calR->Group2_AMBDAC,calR->Group2_step,calR->Group2_RF,calR->state,g2_led); // AGC_LOG("AGC333: led_drv=%d,ledDac=%d,ambDac=%d,ledstep=%d,rf=%d,state = %d\r\n",\ // calR->Group3_Cur, calR->Group3_Ledidac, calR->Group3_AMBDAC,calR->Group3_step,calR->Group3_RF,calR->state); } diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 5fab00c61..879379721 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2434,6 +2434,11 @@ void uapi_exit_power_saving_mode(void) // //开广播 if(cm_custom_ble_service_on_flag()) uapi_open_br_scan(); + //根据配置自动回连 + if(uapi_dev_runtime_get_bt_powerstat() && (cm_get_HFP_switch() || cm_get_A2DP_switch())) + { + uapi_hfp_connect(); + } //打开cat1 if(cm_poweron_cat1_on_bootup_flag()) uapi_set4GCapability(true); -- 2.17.1