Explorar o código

步数统计时候,需要加入有效的时间间隔,避免走路下来的噪声

jianboliang %!s(int64=4) %!d(string=hai) anos
pai
achega
121a906406

+ 6 - 1
smart_shoes/nRF5_SDK_17.0.0_9d13099/examples/proprietary_rf/esb_prx/footPDR.c

@@ -86,6 +86,8 @@ int last_stage;
 uint8_t step_count;
 uint16_t step_distance;
 
+int step_time = 0;
+
 //
 short pos_offset_max = 0;
 short pos_offset_min = 0;
@@ -841,9 +843,12 @@ unsigned char footPDR(int num, float *gyr, float *acc, int press, short* pos_res
 	{
 		
 		//计算一步的距离及步数+1
-		if(last_stage == 2)
+		//做一个计算时间时间,防止非正常走路的情况出来
+		if(last_stage == 2 && frame_index - step_time > 30)
 		{
 			cal_step_data();
+			
+			step_time = frame_index;
 		}
 		
 		stand_num = stand_num + 1;