From a1a8ad0cba66e2999f65385f5f8077a7dd8fa057 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期五, 08 十一月 2019 12:55:27 +0800
Subject: [PATCH] 增加数据溢出异常处理

---
 源码/核心板/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 83dcf89..85812fc 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"
@@ -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;
@@ -337,7 +338,7 @@
 	for(i=0;i<g_com_map[MAX_REPORT_ANC_NUM];i++)
 	{
 	/* Write frame data to DW1000 and prepare transmission. See NOTE 7 below. */
-	tx_poll_msg[ANC_TYPE_IDX] = i-1;
+	tx_poll_msg[ANC_TYPE_IDX] = i;
 		
 	dwt_writetxdata(sizeof(tx_poll_msg), tx_poll_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
 	dwt_writetxfctrl(sizeof(tx_poll_msg), 0);//设置超宽带发送数据长度
@@ -418,14 +419,21 @@
 			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;//数据段长度
 					usart_send[4] = frame_seq_nb;//数据段长度
 					memcpy(&usart_send[5],&dev_id,2);
 					memcpy(&usart_send[7],&rx_buffer[ANCHOR_ID_IDX],2);
-					hex_dist = anchor_dist_last_frm[0];;
+					hex_dist = anchor_dist_last_frm[0]+(int16_t)g_com_map[DIST_OFFSET];
 					memcpy(&usart_send[9],&hex_dist,4);
 					usart_send[13] = battary;
 					usart_send[14] = button;
@@ -602,6 +610,8 @@
 //					dist[TAG_ID] = LP(dis, TAG_ID); //LP 为低通滤波器,让数据更稳定
 					
 					/*--------------------------以下为非测距逻辑------------------------*/
+					//dist_cm=33000;
+					
 					LED0_BLINK; //每成功一次通讯则闪烁一次
 					g_UWB_com_interval = 0;
 					dis_after_filter=dist_cm;

--
Gitblit v1.9.3