From 1e1b1b9f73152b17b960c5c2b1531d66ca4ddbe0 Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期一, 26 五月 2025 18:15:11 +0800
Subject: [PATCH] 移植完新版lora和新版测距代码,lora传输有问题未解决

---
 keil/include/drivers/uwb_app.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/keil/include/drivers/uwb_app.c b/keil/include/drivers/uwb_app.c
index dec30a9..315abe6 100644
--- a/keil/include/drivers/uwb_app.c
+++ b/keil/include/drivers/uwb_app.c
@@ -281,7 +281,7 @@
 /* RX done process handler. */
 int8_t rssi;
 uint32_t range_timeout_us = 2000000;//yuan5000
-uint8_t flag_temp2,flag_temp1;
+uint8_t flag_temp2,flag_temp1,resp_tx_flag;
 uint16_t uwb_losttimer;
 static void rx_int_callback(struct MAC_HW_REPORT_T *rx_report)
 {		uint8_t valid_sts=0;
@@ -290,7 +290,7 @@
 
     /** UWB RX success */
     if (rx_report->err_code == UWB_RX_OK)
-    {
+    {		resp_tx_flag=0;
         /* Received data does not contain FCS */
         rx_length = rx_report->pkt_len;
         memcpy(rx_buf, rx_report->pkt_data, rx_length);
@@ -303,6 +303,10 @@
         rssi = rx_report->rssi;
         receive_flag=1;
 				Anchor_App();
+			if(resp_tx_flag==0)
+			{
+			  OpenUWB();
+			}
 			#ifdef STS_MODE
 				valid_sts= sts_valid_check();
       if (valid_sts)
@@ -330,9 +334,9 @@
 			        temp_count= phy_timer_count_get();
         memcpy(&rx_rpt, rx_report, sizeof(struct MAC_HW_REPORT_T));
         rx_length = 0;
-			//	OpenUWB();//再次开启UWB接收
+				OpenUWB();//再次开启UWB接收
     }
-	OpenUWB();//再次开启UWB接收
+	//OpenUWB();//再次开启UWB接收
 }
 
 /* TX done process handler. */
@@ -346,6 +350,7 @@
     {
         temp_count= phy_timer_count_get();
         temp_internal=temp_count;
+				OpenUWB();
         resp_tx_num++;
 		//		OpenUWB();//再次开启UWB接收
         //LOG_INFO(TRACE_MODULE_APP, "poll_rx_num is %d,resp_tx_num is %d\r\n",poll_rx_num,resp_tx_num);
@@ -468,7 +473,7 @@
     for(i=0; i<taglist_num; i++)
     {		
 			
-			if(tagofflinetime[i]++<REPORT_TAG_KEEPTIMES)
+			if(tagofflinetime[i]<REPORT_TAG_KEEPTIMES)
         {
             report_ancid[k]=tagid_list[i];
             report_ancdist[k++]=(uint16_t)tagdist_list[i];
@@ -517,6 +522,7 @@
     temp_resp_i64=resp_tx_ts_i64;
     temp_count3= phy_timer_count_get();
     flag_temp2=uwb_tx(send_buffer, 40,1 ,resp_tx_en_start_u32);//立即发送测试size大小
+		resp_tx_flag=1;//限制重复开启
 		tagofflinetime[taglist_pos] = 0;//更新标签通信
 //    temp_count1=phy_timer_count_get();
     //while(mac_is_busy());
@@ -595,7 +601,7 @@
 		if(secondtask_search_flag)//更新S时间TICK
 		{
 		HIDO_TimerTick();
-		TagListUpdate();
+		//TagListUpdate();
 //    GPS_Poll();
 //		if(nomove_count<=g_com_map[NOMOVESLEEP_TIME])//防止溢出
 //    nomove_count++;

--
Gitblit v1.9.3