From 85dfd0e1c60df3c90ea5017c58f111aa797efa52 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Thu, 5 Sep 2024 15:19:30 +0800 Subject: [PATCH] =?utf8?q?=E5=BF=83=E7=8E=87=E5=A2=9E=E5=8A=A00=E6=95=B0?= =?utf8?q?=E6=8D=AE=E4=BC=A0=E9=80=92=EF=BC=8C=E6=8A=A50=E6=98=BE=E7=A4=BA?= =?utf8?q?=E2=80=9C--=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../drivers/peripheral/ppg/hx3695/hx3695.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index ef80e512a..67484b953 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2708,16 +2708,7 @@ 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); - hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); - if(func != NULL) - { - hrsresult.lastesthrs = avg_hrs; - 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)); - } - } + hrsresult.lastesthrs = avg_hrs; if(hrs_mode_state) { cywee_data = hrsresult.lastesthrs; @@ -2894,20 +2885,28 @@ void hx3695_hrs_ppg_Int_handle(void) if(hrs_wear_status == MSG_HRS_WEAR && hrsresult.hr_living == MSG_LIVING_TRUE) { - if(hrsresult.lastesthrs > 50) + if(hrsresult.lastesthrs > 60 || hrsresult.lastesthrs == 0) get_avg_hrs(hrsresult.lastesthrs); hrsresult.wearstatus = MSG_HRS_WEAR; } else { hrsresult.wearstatus = MSG_HRS_NO_WEAR; + hrsresult.lastesthrs = 0; } hx3695_msg_callback_t func = hx3695_get_send_msg_callback_func(); if(func != NULL) { - func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + 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)); } + //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); -- 2.17.1