From bd2731841bc12c306baf005ffb1f2e5d58c12fdd Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期四, 10 十月 2024 15:27:08 +0800
Subject: [PATCH] 标签加入低功耗并加入波形临时版本,接收窗口重开时间较长bug导致有多设备干扰时测距不稳bug,配合手环4G低功耗前稳定版本使用

---
 keil/dw_app.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/keil/dw_app.c b/keil/dw_app.c
index 0f00856..63a0746 100644
--- a/keil/dw_app.c
+++ b/keil/dw_app.c
@@ -5,6 +5,7 @@
 #include "mk_misc.h"
 #include "mk_uart.h"
 #include "mk_trace.h"
+#include "global_param.h"
 static float clockOffsetRatio;
 static double rtd_init, rtd_resp;
 double tof,distance;
@@ -35,7 +36,7 @@
     memcpy(&tag_resprx[i],&resprx,4);
     memcpy(&anc_distoffset[i],distoffset,2);
 		memcpy(&tag_polltx[i],&polltx,4);
-    //anc_clockoffset[i] = anc_clockoffset_from_MK;//MK8000修改
+    anc_clockoffset[i] = freq_offset;//MK8000修改
 }
 void CalculateDists1(int64_t poll_tx_ts) 
 {
@@ -108,7 +109,7 @@
 			// correct antenna delay
 //    tround -= ranging_ant_delays_get(uwb_app_config.ppdu_params.rx_ant_id);
 			// corrected by frequency offset
-			tround = (int64_t)((double)tround * (1 - (double)freq_offset_filter / ch_center_freq_map[UWB_CH_NUM]));
+			tround = (int64_t)((double)tround * (1 - (double)anc_clockoffset[i] / ch_center_freq_map[UWB_CH_NUM]));
 			tround_temp=tround;
 			treply_temp=treply;
 			tof_i = (int32_t)(tround - treply) / 2;
@@ -128,8 +129,10 @@
 			
 			 if(distance>-1000&&distance<100000)
           {
-            nearbase_distlist[i]  = distance+anc_distoffset[i];//offset未加
-          }
+            nearbase_distlist[i]  = distance+(int16_t)g_com_map[OFFSET_AS_URT_TAG];//offset未加
+          }else{
+						nearbase_distlist[i] = 0x2ffff;
+					}
       }else{
           nearbase_distlist[i] = 0x1ffff;
       }

--
Gitblit v1.9.3