From 20ef2d42f15f2763a5079929fc7c375e9c94b697 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期六, 09 十一月 2019 14:16:39 +0800
Subject: [PATCH] V1.5 修改数据溢出bug

---
 源码/核心板/Src/application/dw_app.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c" "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c"
index 8ef4487..58345cd 100644
--- "a/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c"
+++ "b/\346\272\220\347\240\201/\346\240\270\345\277\203\346\235\277/Src/application/dw_app.c"
@@ -134,7 +134,7 @@
 
 static double tof;
 	
-uint32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS];	;	
+int32_t anchor_dist_last_frm[TAG_NUM_IN_SYS],his_dist[TAG_NUM_IN_SYS];	;	
 uint32_t tag_id = 0;
 uint32_t tag_id_recv = 0;
 uint8_t random_delay_tim = 0;
@@ -318,6 +318,7 @@
 int8_t tag_delaytime;
 extern uint16_t sync_timer;
 u16 tmp_time;
+int32_t temp_dist;
 void Tag_App(void)//发送模式(TAG标签)
 {
 	uint32_t frame_len;
@@ -418,7 +419,14 @@
 			tag_succ_times++;
 			
 				LED0_BLINK;
-			
+//				temp_dist=anchor_dist_last_frm[0];
+//				if(anchor_dist_last_frm[0]>1000000)
+//				{
+//					temp_dist=anchor_dist_last_frm[0]-0xffffffff;
+//					temp_dist+=0xffff;
+//					anchor_dist_last_frm[0]=temp_dist;
+//				}
+
 					
 					usart_send[2] = 1;//正常模式
 					usart_send[3] = 17;//数据段长度
@@ -602,10 +610,12 @@
 //					dist[TAG_ID] = LP(dis, TAG_ID); //LP 为低通滤波器,让数据更稳定
 					
 					/*--------------------------以下为非测距逻辑------------------------*/
+					//dist_cm=33000;
+					
 					LED0_BLINK; //每成功一次通讯则闪烁一次
 					g_UWB_com_interval = 0;
 					dis_after_filter=dist_cm;
-					hex_dist = (int16_t)(dist_cm+g_com_map[DIST_OFFSET]);
+					hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET];
 						if(tag_id_recv-TAG_ID_START<=TAG_NUM_IN_SYS)
 					if(abs(hex_dist-his_dist[tag_id_recv-TAG_ID_START])<1000)
 					{

--
Gitblit v1.9.3