From: 彭磊 <1624952103@qq.com> Date: Fri, 11 Oct 2024 11:19:25 +0000 (+0000) Subject: Merge #1162 into sdk602patch0911 from refs/changes/1162/head X-Git-Tag: release_V1.2.70_20241020_135402~75^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4019fae2a79f3474a7eb21a6dbce280fd60f64f2;p=mirrors%2FFD230.git Merge #1162 into sdk602patch0911 from refs/changes/1162/head Code review from 彭磊 * refs/changes/1162/head: (2 commits squashed) - 更新gsensor dml库,修复FATAL ERROR bug与运动数据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/1162 --- diff --git a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_DML_clang_riscv.a b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_DML_clang_riscv.a index c3e85e16a..c7ba3a86f 100644 Binary files a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_DML_clang_riscv.a and b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_DML_clang_riscv.a differ diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 5833a6937..7146f7ba9 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -21,7 +21,7 @@ #define AP_ENABLE_DML_SDO_LISTEN -#define GSENSON_MSG_COUNT 15 +#define GSENSON_MSG_COUNT 16 static gsenson_t gxyz_t; static uint8_t gsenson_falg=0; @@ -1082,12 +1082,12 @@ struct AccelerationData { float acc_y; float acc_z; }; -static struct AccelerationData rawdata[GSENSON_MSG_COUNT]; //自定义buffer,用来缓存sensor数据 +static struct AccelerationData rawdata[25]; //自定义buffer,用来缓存sensor数据 static int AccdataCount = 0; //fifo长度 void CWM_AP_dmlSensorDataOutput_listen(const dml_sensorData_t * pSdo) { - if(AccdataCount < GSENSON_MSG_COUNT) + if(AccdataCount < 25) { if (pSdo->validData & DML_SENSOR_DATA_VALID_DT) { @@ -1311,7 +1311,7 @@ int cywee_main_dml(void) scl.iData[0] = 1; #ifdef AP_ENABLE_DML_SDO_LISTEN scl.iData[2] = 2+16; //分离式DML - CWM_CustomSensorInput_Fifo_Init(GSENSON_MSG_COUNT); + CWM_CustomSensorInput_Fifo_Init(25); #else scl.iData[1] = 18; //00000000000000000000000000010010 高位在前 #endif @@ -1329,7 +1329,7 @@ int cywee_main_dml(void) #else scl.iData[3] = 2; scl.iData[4] = 1; //1 anytime 2 fifo - scl.iData[6] = 25; //fifocount 先設定5 [1~25] + scl.iData[6] = GSENSON_MSG_COUNT; //fifocount 先設定5 [1~25] scl.iData[8] = 26; // for st sensor(52Hz) scl.iData[11] = 4; // G_INT_1 diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 86223bdaf..f6ffc4223 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2831,8 +2831,36 @@ void hx3695_hrs_ppg_Int_handle(void) } memset(gsensordata,0.0f,sizeof(gsenson_t) * 8); - // gsensor_get_n_data(8,gsensordata); + gsensor_get_n_data(8,gsensordata); + for(ii=0; ii<*count; ii++) + { + if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) + { + timeout++; + if(timeout > 20) + { + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL); + } + } + else + { + timeout = 0; + } + if(ii == 8) + { + gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1]; + gsen_fifo_y_send[ii] = gsen_fifo_y_send[ii - 1]; + gsen_fifo_z_send[ii] = gsen_fifo_z_send[ii - 1]; + } + else + { + gsen_fifo_x_send[ii] = gsensordata[ii].x * 4096 / 10; + gsen_fifo_y_send[ii] = gsensordata[ii].y * 4096 / 10; + gsen_fifo_z_send[ii] = gsensordata[ii].z * 4096 / 10; + } + + // gsensor_get_n_data(8,gsensordata); // for(ii=0; ii<*count; ii++) // { // if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) @@ -2847,51 +2875,23 @@ void hx3695_hrs_ppg_Int_handle(void) // { // timeout = 0; // } - // if(ii == 8) - // { - // gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1]; - // gsen_fifo_y_send[ii] = gsen_fifo_y_send[ii - 1]; - // gsen_fifo_z_send[ii] = gsen_fifo_z_send[ii - 1]; - // } - // else + // // if(ii == 8) + // // { + // // gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1]; + // // gsen_fifo_y_send[ii] = gsen_fifo_y_send[ii - 1]; + // // gsen_fifo_z_send[ii] = gsen_fifo_z_send[ii - 1]; + // // } + // // else + // // { + // if(ii < 9) // { // gsen_fifo_x_send[ii] = gsensordata[ii].x * 4096 / 10; // gsen_fifo_y_send[ii] = gsensordata[ii].y * 4096 / 10; // gsen_fifo_z_send[ii] = gsensordata[ii].z * 4096 / 10; // } - gsensor_get_n_data(5,gsensordata); - for(ii=0; ii<*count; ii++) - { - if(gsensordata[ii].x == 0.0f && gsensordata[ii].y == 0.0f && gsensordata[ii].z == 0.0f) - { - timeout++; - if(timeout > 20) - { - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESTART_ACC,NULL); - } - } - else - { - timeout = 0; - } - // if(ii == 8) - // { - // gsen_fifo_x_send[ii] = gsen_fifo_x_send[ii - 1]; - // gsen_fifo_y_send[ii] = gsen_fifo_y_send[ii - 1]; - // gsen_fifo_z_send[ii] = gsen_fifo_z_send[ii - 1]; - // } - // else - // { - if(ii < 9) - { - gsen_fifo_x_send[ii] = gsensordata[ii/2].x * 4096 / 10; - gsen_fifo_y_send[ii] = gsensordata[ii/2].y * 4096 / 10; - gsen_fifo_z_send[ii] = gsensordata[ii/2].z * 4096 / 10; - } - - // } - + // } + // PRINT("hxdata:%d/%d %d %d %.3f %.3f %.3f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsensordata[ii].x,gsensordata[ii].y,gsensordata[ii].z,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); //PRINT("hxdata:%d/%d %d %d %.3f %.3f %.3f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsensordata[ii].x,gsensordata[ii].y,gsensordata[ii].z,ppg_s_data.green_cur);