From aa66ec8b6b0d9cc259a0d0ef12875a65d28cbd30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BD=AD=E7=A3=8A?= <1624952103@qq.com> Date: Thu, 17 Oct 2024 06:50:26 +0000 Subject: [PATCH] Merge #1206 into sdk602patch0911 from refs/changes/1206/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 彭磊 * refs/changes/1206/head: (2 commits squashed) - 修复gsensor性别设置错误的bug,修复重复开启gsensor的bug - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 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/1206 --- .../drivers/peripheral/cywee/src/main_dml.c | 22 ++++++++++++------- .../drivers/peripheral/ppg/hx3695/hx3695.c | 5 ++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 175cb86fc..89da4be03 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -68,11 +68,11 @@ static int sedentary_interval = 1; static int sedentary_interval_count = 0; -#ifdef FD230 -static int cywee_switch = 1; -#else -static int cywee_switch = 0; -#endif +// #ifdef FD230 +// static int cywee_switch = 1; +// #else +// static int cywee_switch = 0; +// #endif static uint8_t cywee_is_active = 0; static uint8_t is_static_state = 0; @@ -157,7 +157,12 @@ uint8_t cywee_get_active_state(void) void cywee_stop(void) { - cywee_switch = 0; + // cywee_switch = 0; + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 1; + scl.iData[2] = 0; + CWM_SettingControl(SCL_DML_DRV_ENABLE, &scl); } void cywee_get_acc_switch(int cmd) @@ -434,7 +439,7 @@ void cywee_set_user_info(void) memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[1] = user_info[0]; - scl.iData[2] = user_info[1]; + scl.iData[2] = !user_info[1]; //APP 1女 0男 scl.iData[3] = user_info[2]; scl.iData[4] = user_info[3]; scl.iData[5] = user_info[4]; @@ -1312,6 +1317,7 @@ int cywee_main_dml(void) memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; #ifdef AP_ENABLE_DML_SDO_LISTEN + // scl.iData[1] = 4+16; scl.iData[2] = 2+16; //分离式DML CWM_CustomSensorInput_Fifo_Init(25); #else @@ -1482,7 +1488,7 @@ int cwm_lib_process(void) //运行算法 void cywee_int_handler(void) { - if(cywee_switch == 1) + // if(cywee_switch == 1) { #ifdef AP_ENABLE_DML_SDO_LISTEN cwm_lib_process(); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index f6ffc4223..152079c81 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2755,6 +2755,7 @@ hrs_sensor_data_t hrs_s_dat; static uint8_t his_wear = 2; static uint8_t wear_cnt = 0; +static uint8_t acc_restart_flag = 0; void hx3695_hrs_ppg_Int_handle(void) { @@ -2838,14 +2839,16 @@ void hx3695_hrs_ppg_Int_handle(void) if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) { timeout++; - if(timeout > 20) + if(timeout > 20 && !acc_restart_flag) //避免重复开关gsensor { do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL); + acc_restart_flag = 1; } } else { timeout = 0; + acc_restart_flag = 0; } if(ii == 8) { -- 2.17.1