From: penglei <1624952103@qq.com> Date: Sat, 27 Apr 2024 06:53:32 +0000 (+0800) Subject: 优化动态心率 X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~64 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=refs%2Fchanges%2F98%2Fhead;p=mirrors%2FFD230.git 优化动态心率 --- diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 793de1b15..57509ea1e 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -19,13 +19,13 @@ #define AP_ENABLE_DML_SDO_LISTEN -#define GSENSON_MSG_COUNT 8 +#define GSENSON_MSG_COUNT 25 static gsenson_t gxyz_t; static uint8_t gsenson_falg=0; static uint16 num_falg=0; -static gsenson_t gxyz_t_queue[8]={0}; +static gsenson_t gxyz_t_queue[25]={0}; static int16 left_falg=0; static int16 right_falg=-1; @@ -279,7 +279,7 @@ void gsensor_get_n_data(uint8_t cnt,gsenson_t t[]) // CWM_OS_dbgPrintf("get_gsonsen_xyz_fail\n"); // return; // } - //CWM_OS_dbgPrintf("x : %d , y : %d , z : %d\n", gxyz_t_queue[left_falg].x, gxyz_t_queue[left_falg].y, gxyz_t_queue[left_falg].z); + CWM_OS_dbgPrintf("x=%.3f, y=%.3f, z=%.3f\n", gxyz_t_queue[left_falg].x, gxyz_t_queue[left_falg].y, gxyz_t_queue[left_falg].z); t[i].x= gxyz_t_queue[left_falg].x; t[i].y= gxyz_t_queue[left_falg].y; t[i].z= gxyz_t_queue[left_falg].z; @@ -287,7 +287,7 @@ void gsensor_get_n_data(uint8_t cnt,gsenson_t t[]) if(num_falg) { left_falg++; - left_falg=left_falg%8; + left_falg=left_falg%25; num_falg--; } @@ -308,12 +308,12 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { // sensorEVT->fData[1], // sensorEVT->fData[2] // ); - if(num_falg==8) + if(num_falg==25) { left_falg++; right_falg++; - right_falg=right_falg%8; - left_falg=left_falg%8; + right_falg=right_falg%25; + left_falg=left_falg%25; gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; gxyz_t_queue[right_falg].y= sensorEVT->fData[1]; gxyz_t_queue[right_falg].z= sensorEVT->fData[2]; @@ -322,7 +322,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { //left_falg++; right_falg++; - right_falg=right_falg%8; + right_falg=right_falg%25; //left_falg=left_falg%16; num_falg++; gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; @@ -391,12 +391,9 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { CWM_OS_dbgPrintf("CUSTOM_OFFBODY_DETECT !!! \r\n"); if((int)sensorEVT->fData[2] == 1) - { - memset(&csd, 0, sizeof(CUSTOM_OFFBODY_DETECT)); - csd.sensorType = CUSTOM_OFFBODY_DETECT; - csd.fData[0] = 1; - CWM_CustomSensorInput(&csd); - } + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_WEAR_MODE_TEST); + else + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST); } if((int)sensorEVT->fData[1] == CUSTOM_ON_CHARGING) { @@ -845,18 +842,18 @@ int cywee_main_dml(void) CWM_SettingControl(SCL_DML_DRV_ENABLE, &scl); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[3] = 3; - scl.iData[4] = 5; + // memset(&scl, 0, sizeof(scl)); + // scl.iData[0] = 1; + // scl.iData[3] = 3; + // scl.iData[4] = 5; CWM_Sensor_Enable(IDX_REQUEST_SENSOR); // //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); CWM_Sensor_Enable(IDX_ALGO_WATCH_HANDUP); CWM_Sensor_Enable(IDX_ALGO_ACTIVITY_OUTPUT); - //CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); - //CWM_Sensor_Enable(IDX_ALGO_SEDENTARY); - //CWM_Sensor_Enable(IDX_ALGO_SLEEP); + CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); + // CWM_Sensor_Enable(IDX_ALGO_SEDENTARY); + // CWM_Sensor_Enable(IDX_ALGO_SLEEP); CWM_Sensor_Enable(IDX_ACCEL); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); // CWM_Sensor_Enable(IDX_GYRO); @@ -868,9 +865,8 @@ int cywee_main_dml(void) cyw_activity_mode_change(SPORT_ACTIVE_MODE_NORMAL); - //cyw_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY); + cyw_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY); - send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_WEAR_MODE_TEST); // cyw_activity_mode_change(cmd); // if(cmd == SPORT_ACTIVE_MODE_NORMAL) // { diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index a0b722367..c50843984 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2765,8 +2765,8 @@ void hx3695_hrs_ppg_Int_handle(void) if(*count < 10) { gsensor_get_n_data(8,gsensordata); - for(ii=0; ii<*count; ii++) - { + for(ii=0; ii<*count; ii++) + { if(ii == 8) { gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1]; @@ -2778,12 +2778,13 @@ void hx3695_hrs_ppg_Int_handle(void) // gsen_fifo_x_send[ii] = (gsensordata[ii*2].x + gsensordata[2*ii + 1].x)/2; // gsen_fifo_y_send[ii] = (gsensordata[ii*2].y + gsensordata[2*ii + 1].y)/2; // gsen_fifo_z_send[ii] = (gsensordata[ii*2].z + gsensordata[2*ii + 1].z)/2; - gsen_fifo_x_send[ii] = gsensordata[ii].x; - gsen_fifo_y_send[ii] = gsensordata[ii].y; - gsen_fifo_z_send[ii] = gsensordata[ii].z; + gsen_fifo_x_send[ii] = gsensordata[ii].x * 2048; + gsen_fifo_y_send[ii] = gsensordata[ii].y * 2048; + gsen_fifo_z_send[ii] = gsensordata[ii].z * 2048; } - PRINT("hxdata:%d/%d %d %d %.2f %.2f %.2f %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],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); + } hrs_wear_status = hx3695_hrs_get_wear_status(); PRINT("hrs_wear_status: %d !!\r\n", hrs_wear_status); @@ -3492,7 +3493,7 @@ 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); hrsresult.wearstatus = hx3695_wear_status; - PRINT("hx3695_wear_status : %d \r\n",hx3695_wear_status); + // PRINT("hx3695_wear_status : %d \r\n",hx3695_wear_status); if(wear_mode_status != hx3695_wear_status) { wear_mode_status = hx3695_wear_status; diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index c9d5a99f6..2ce4175b3 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -57,7 +57,7 @@ uint8_t light_databuf[64] = {0}; #define PPG_SERVICE_MSG_COUNT 16 -#define PPG_SERVICE_TASK_SIZE 0x900 +#define PPG_SERVICE_TASK_SIZE 0x1000 #define PPG_SERVICE_TASK_PRIO 5 #define MAG_CHECK_MS 20