From b660ffcc47c00bdf00a40a2c8b7fcb60e6fc794e Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期日, 19 九月 2021 18:05:08 +0800
Subject: [PATCH] V1.66 修改继电器触发延迟BUG

---
 源码/核心板/Src/application/dw_app.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 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 17a2dd3..9412bb3 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"
@@ -115,6 +115,7 @@
 		}
 	}
 }
+extern u16 g_commap_antdelay;
 void Dw1000_Init(void)
 {
 	/* Reset and initialise DW1000.
@@ -131,7 +132,7 @@
 	
     /* Apply default antenna delay value. See NOTE 1 below. */
     dwt_setrxantennadelay(RX_ANT_DLY);		//设置接收天线延迟
-    dwt_settxantennadelay(TX_ANT_DLY);		//设置发射天线延迟
+    dwt_settxantennadelay(g_commap_antdelay);		//设置发射天线延迟
 
     /* Set expected response's delay and timeout. See NOTE 4 and 5 below.
      * As this example only handles one incoming frame with always the same delay and timeout, those values can be set here once for all. */
@@ -836,6 +837,7 @@
 				dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
 			}
 }
+u16 smallcar_idlist[10]={0x4052,0x4032,0x4055,0x4034,0x4016,0x4010,0x4036,0x4027,0x4024,0x4047};
 extern u16 dist_threshold;
 u8 misdist_num[TAG_NUM_IN_SYS],seize_anchor,getrange_success=0;
 int32_t filter_dist,filter_speed;
@@ -915,6 +917,7 @@
 					uint32_t poll_rx_ts_32, resp_tx_ts_32, final_rx_ts_32;
 					double Ra, Rb, Da, Db;
 					int64_t tof_dtu;
+                    u8 si;
 					resp_tx_ts = get_tx_timestamp_u64();//获得response发送时间T3
 					final_rx_ts = get_rx_timestamp_u64();//获得final接收时间T6
 					final_msg_get_ts(&rx_buffer[FINAL_MSG_POLL_TX_TS_IDX], &poll_tx_ts);//从接收数据中读取T1,T4,T5
@@ -940,7 +943,15 @@
 					LED0_BLINK; //每成功一次通讯则闪烁一次
 					dis_after_filter=dist_cm;
 					hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10;
+                    for(si=0;si<10;si++)
+                    {
+                        if(smallcar_idlist[si]==tag_id_recv)
+                        {
+                            hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]*10-(int16_t)g_com_map[NOMOVESLEEP_TIME]*10;
+                        }
+                    }
 					g_flag_Taggetdist[taglist_pos]=0;
+                    
 					if(hex_dist>-1000&&hex_dist<2000000)
 					{
 					if(abs(hex_dist-his_dist[taglist_pos])<dist_threshold||misdist_num[taglist_pos]>3)
@@ -959,7 +970,7 @@
 						misdist_num[taglist_pos]=0;
 					tagdist_list[taglist_pos] = filter_dist;	
 					his_dist[taglist_pos]=hex_dist;	
-						g_Tagdist[taglist_pos]=filter_dist;	
+						g_Tagdist[taglist_pos]=hex_dist/10;	
 				#ifdef USART_SINGLE_OUTPUT
 					usart_send[2] = 1;//正常模式 
 					usart_send[3] = 17;//数据段长度

--
Gitblit v1.9.3