From 0781da980b9359a5542bacba06b6a60b0508650c Mon Sep 17 00:00:00 2001
From: zhyinch <zhyinch@gmail.com>
Date: 星期四, 02 四月 2020 22:08:23 +0800
Subject: [PATCH] 增加标签随机位置模式

---
 源码/核心板/Src/application/dw_app.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 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 2647999..0b3b968 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"
@@ -345,6 +345,7 @@
 		change_base_count=0;
 	}
 }
+u8 anclost_times=0;
 void NearPoll(void)
 {
 	static u8 mainbase_lost_count=0,flag_finalsend;
@@ -417,7 +418,7 @@
 									//////////////////////////////////时间同步
 									memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2);
 									memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2);
-									memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2);		
+//									memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2);		
 									tmp_time=tmp_time+450;
 									if(tmp_time>999)
 									{
@@ -427,9 +428,9 @@
 											{sync_timer=0;}
 									}
 									TIM3->CNT=tmp_time;
-									if(tagslotpos>max_slotpos)
-										tagslotpos=tagslotpos%(max_slotpos+1);
-										tyncpoll_time=(tagslotpos-1)*slottime;
+//									if(tagslotpos>max_slotpos)
+//										tagslotpos=tagslotpos%(max_slotpos+1);
+//										tyncpoll_time=(tagslotpos-1)*slottime;
 									////////////////////////////
 									mainbase_lost_count=0;
 									flag_finalsend=1;
@@ -489,15 +490,19 @@
 				tag_state=DISCPOLL;
 			}
 			NearAncSelect();
-//				if(result==0)
-//			{while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))//不断查询芯片状态直到发送完成
-//			{ };			
-//	
-//	}
-//	else
-//	{
+			if(recbase_num<g_com_map[MIN_REPORT_ANC_NUM] )
+			{
+				anclost_times++;
+				if(anclost_times>3)
+				{
+					tagslotpos=poll_tx_ts%(max_slotpos+1);
+				}
+			}else{
+				anclost_times=0;
+			}
+
 	dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR);
-//	}
+
 
 }
 
@@ -560,9 +565,9 @@
 	 
 			break;
 		case NEARPOLL:
-			GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET);
+			//GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET);
 			NearPoll();
-			GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET);
+			//GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET);
 			break;
 	}
 }

--
Gitblit v1.9.3