From 4d7183688398cd3e6fa9c0b7f74d4f47b4fab37e Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期三, 20 八月 2025 15:25:04 +0800
Subject: [PATCH] V1.53 随机时间片跳

---
 Src/application/dw_app.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index 2c58786..f895367 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -76,7 +76,7 @@
     DISCPOLL,
     GETNEARMSG,
     NEARPOLL,
-} tag_state=GETNEARMSG;
+} tag_state=NEARPOLL;
 static dwt_config_t config = {
     5,               /* Channel number. */
     DWT_PRF_64M,     /* Pulse repetition frequency. */
@@ -501,7 +501,7 @@
                     memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2);
                     memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2);
                     current_count=HAL_LPTIM_ReadCounter(&hlptim1);
-										memcpy(&rec_tagslotpos,&rx_buffer[TAGSLOTPOS],2);
+									//	memcpy(&rec_tagslotpos,&rx_buffer[TAGSLOTPOS],2);
 										tmp_time=tmp_time+450;
 										if(tmp_time>999)
 										{
@@ -571,7 +571,7 @@
 									  memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2);
                     memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2);
                     current_count=HAL_LPTIM_ReadCounter(&hlptim1);
-										memcpy(&rec_tagslotpos,&rx_buffer[TAGSLOTPOS],2);
+									//	memcpy(&rec_tagslotpos,&rx_buffer[TAGSLOTPOS],2);
 										tmp_time=tmp_time+450;
 										if(tmp_time>999)
 										{
@@ -627,7 +627,8 @@
     j=0;
 		if(sync_anc_losttime!=0)
 		{
-			NextSlotDelayMs(0);
+            rec_tagslotpos=HAL_LPTIM_ReadCounter(&hlptim1)%bigslot_num;
+			SetLPTimer(0);
 		}
     //	tyncpoll_time=0;
     next_nearbase_num=0;
@@ -757,8 +758,13 @@
     {
         id =  dwt_readdevid() ;
     }
-
     g_Resttimer=0;
+		if(bat_percent>15)
+			{
+				LED_TB_ON;
+			} else {
+				LED_TR_ON;
+			}
 //	tag_state=DISCPOLL;
     switch(tag_state)
     {
@@ -777,4 +783,6 @@
         break;
     }
     dwt_entersleep();
+		LED_TB_OFF;
+		LED_TR_OFF;
 }

--
Gitblit v1.9.3