From 8a64dd03a6565f25a4920171fb18d41f49aa8d11 Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期日, 05 七月 2020 23:46:50 +0800
Subject: [PATCH] 防撞9对5测试完成,发给华星

---
 源码/核心板/Src/application/dw_app.c |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 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 5c15035..e672903 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"
@@ -402,7 +402,7 @@
 									temp_sync_timer2=sync_timer;
 									memcpy(&temp_sync_timer1,&rx_buffer[ANCTIMEMS],2);
 									memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2);
-									exsistbase_list[0]=KEEP_TIMES;
+									
 									
 									if(g_com_map[DEV_ROLE]!=0)
 									{
@@ -426,10 +426,12 @@
 //										tyncpoll_time=(tagslotpos-1)*slottime;
 									////////////////////////////
 									rec_nearbasepos=0;
-									exsistbase_list[rec_nearbasepos]=KEEP_TIMES;
+									
 									memcpy(&temp_dist,&rx_buffer[DIST_IDX],4);
 									nearbase_distlist[rec_nearbasepos]=temp_dist;
-									
+								if(temp_dist!=0x1ffff)
+									exsistbase_list[rec_nearbasepos]=KEEP_TIMES;
+								
 									mainbase_lost_count=0;
 									flag_finalsend=1;
 									final_tx_time = (resp_rx_ts + ((RESP_RX_TO_FINAL_TX_DLY_UUS+DELAY_BETWEEN_TWO_FRAME_UUS*nearbase_num+500) * UUS_TO_DWT_TIME)) >> 8;
@@ -457,9 +459,11 @@
 										memcpy(&tx_nearfinal_msg[ANCHOR_ID_IDX],&rec_nearbaseid,2);
 									}
 									
-									exsistbase_list[rec_nearbasepos]=KEEP_TIMES;
 									memcpy(&temp_dist,&rx_buffer[DIST_IDX],4);
 									nearbase_distlist[rec_nearbasepos]=temp_dist;
+									
+									if(temp_dist!=0x1ffff)
+									exsistbase_list[rec_nearbasepos]=KEEP_TIMES;
 									
 									final_msg_set_ts(&tx_nearfinal_msg[FINAL_MSG_RESP_RX_NEARBASE_IDX+(rec_nearbasepos)*4], resp_rx_ts);								
 									dwt_writetxdata(28+nearbase_num*4, tx_nearfinal_msg, 0);//将发送数据写入DW1000
@@ -576,13 +580,13 @@
 			}
 			
 		//	printf("%d,%d",temp_sync_timer2,temp_sync_timer1);
-			#ifdef USART_INTEGRATE_OUTPUT		
-				usart_send[2] = 4;//正常模式
-				usart_send[3] = report_num*6+2;//正常模式
-				checksum = Checksum_u16(&usart_send[2],report_num*6+2);
-				memcpy(&usart_send[4+report_num*6],&checksum,2);
-				UART_PushFrame(usart_send,6+report_num*6);
-			#endif
+//			#ifdef USART_INTEGRATE_OUTPUT		
+//				usart_send[2] = 4;//正常模式
+//				usart_send[3] = report_num*6+2;//正常模式
+//				checksum = Checksum_u16(&usart_send[2],report_num*6+2);
+//				memcpy(&usart_send[4+report_num*6],&checksum,2);
+//				UART_PushFrame(usart_send,6+report_num*6);
+//			#endif
 //			if(mainbase_lost_count>5)
 //			{
 //				//tag_state=DISCPOLL;
@@ -799,7 +803,7 @@
 			
 			if(tagdist_list[taglist_pos]<g_com_map[ALARM_DISTANCE1])
 			{
-				motorstate =3;
+				motorstate =0;
 			}else if(tagdist_list[taglist_pos]<g_com_map[ALARM_DISTANCE2])
 			{
 				motorstate =2;
@@ -809,7 +813,7 @@
 			}else{
 				motorstate =0;
 			}
-			tx_nearresp_msg[MOTORSTATE_INDEX]=motorstate;
+			
 			if(new_tagid)
 			{
 				tagdist_list[taglist_pos]=0x1ffff;
@@ -819,9 +823,16 @@
 			}
 			tx_nearresp_msg[MAINBASE_INDEX]=flag_syncbase;
 			tx_nearresp_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE;
-			
+			tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate;
+			if(remotesend_state)
+			{
+			 	memcpy(&tx_nearresp_msg[REMOTEPARA_INDEX],remotetag_para,REMOTEPARA_LEN);
+				dwt_writetxdata(22+REMOTEPARA_LEN, tx_nearresp_msg, 0);//写入发送数据
+				dwt_writetxfctrl(22+REMOTEPARA_LEN, 0);//设定发送长度		
+			}else{
 			dwt_writetxdata(22, tx_nearresp_msg, 0);//写入发送数据
 			dwt_writetxfctrl(22, 0);//设定发送长度
+			}
 			result = dwt_starttx(DWT_START_TX_DELAYED | DWT_RESPONSE_EXPECTED);//延迟发送,等待接收
 
 			battary = rx_buffer[BATTARY_IDX];

--
Gitblit v1.9.3