From f317cd42f19ea851e851600216750ababf89d6c0 Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期四, 13 三月 2025 18:00:20 +0800
Subject: [PATCH] 初步调号极限稳定测距rx间隔

---
 keil/uwb_tag_.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/keil/uwb_tag_.c b/keil/uwb_tag_.c
index 9f6a680..aae755d 100644
--- a/keil/uwb_tag_.c
+++ b/keil/uwb_tag_.c
@@ -25,7 +25,7 @@
 #define POLL_DELAY  100U //yuan100U
 
 /* Receive response timeout */
-#define RESP_RX_TIMEOUT_US 7500U //Yuan500 10mssuccess 300jixian
+#define RESP_RX_TIMEOUT_US 6000U //Yuan500 10mssuccess 300jixian
 
 /* Field index in frame */
 #define MSG_SEQ_NUM_IDX 2
@@ -369,9 +369,9 @@
 }
 uint32_t count_index;
 int tt=1;
-int TagRange(void)
+void uwb_tag_init(void)
 {
-    // The following peripherals will be initialized in the uwb_open function
+// The following peripherals will be initialized in the uwb_open function
     // phy/mac/aes/lsp/phy timers initialized
     uwb_open();
 
@@ -392,15 +392,21 @@
 
     ranging_frame_type_set(config.phy_cfg.sts_pkt_cfg);
 
-    // Register rx interrupt callback function
-    mac_register_process_handler(tx_int_callback, rx_int_callback);
-
+   
+}
+int TagRange(void)
+{
+    
+ phy_timer_open(1, IRQ_PRIORITY_HIGH);
 //#if LOW_POWER_EN
 //    // Initialize low power mode
 //    power_init();
 //    // Enable sleep timer
 //    sleep_timer_open(true, SLEEP_TIMER_MODE_ONESHOT, NULL);
 //#endif
+	 // Register rx interrupt callback function
+	
+    mac_register_process_handler(tx_int_callback, rx_int_callback);
 		uwb_poll_buffer_construct();
 		temp_tag_num=0;//临时数量为0
 		poll_tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(POLL_DELAY);//发送必须要延时发送才可以用于测距否则立即发送会获取时间戳不对,需要计算程序运行时间,避免设置过去时间
@@ -432,7 +438,6 @@
 //	if(tt){
 	while(current_count<end_receive_count||current_count>end_receive_count+HALF_SECOND_TIME)//循环接受包体,若为124.8K则是+62400000
 		{
-		
 		current_count=phy_timer_count_get();//不断刷新当前计数器值
 		temp_count2=phy_timer_count_get();
 		while(mac_is_busy());//等待接收完成

--
Gitblit v1.9.3