From af11ba4290a4631b4495fab92904c1d7a92c8d5a Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期二, 26 十一月 2024 10:23:05 +0800 Subject: [PATCH] 2.58,加入4G 6.5G区别,加入信号强度 --- Src/application/dw_app.c | 47 ++++++++++++++++++++++++++++++----------------- 1 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index 5b3adae..78910e4 100644 --- a/Src/application/dw_app.c +++ b/Src/application/dw_app.c @@ -80,8 +80,13 @@ NEARPOLL, SINGLEPOLL, }tag_state=STARTPOLL; +//#define _UWB_4G static dwt_config_t config = { - 5, /* Channel number. */ +#ifdef _UWB_4G + 2, /* Channel number. */ +#else + 5, +#endif DWT_PRF_64M, /* Pulse repetition frequency. */ DWT_PLEN_128, /* Preamble length. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ @@ -827,24 +832,32 @@ extern int32_t dwt_readcarrierintegrator(void) ; void CalculateDists(void) { - for(int i=0;i<11;i++) + for(int i=0; i<11; i++) { - rec_anc_signalpower[i] = exsistbase_list[i]; - if(exsistbase_list[i]>0) - { + // rec_anc_signalpower[i] = exsistbase_list[i]; + if(exsistbase_list[i]>0) + { - exsistbase_list[i]--; - clockOffsetRatio = anc_clockoffset[i] * (FREQ_OFFSET_MULTIPLIER * HERTZ_TO_PPM_MULTIPLIER_CHAN_2 / 1.0e6) ; - rtd_init = tag_resprx[i] - poll_tx_ts; - rtd_resp = anc_resptx[i] - anc_pollrx[i]; - tof = ((rtd_init - rtd_resp * (1 - clockOffsetRatio)) / 2.0) * DWT_TIME_UNITS; - distance = tof * SPEED_OF_LIGHT; - if(distance>-1000&&distance<100000) - nearbase_distlist[i] = distance*100+anc_distoffset[i]; - }else{ - nearbase_distlist[i] = 0x1ffff; - } - + exsistbase_list[i]--; +#ifdef _UWB_4G + clockOffsetRatio = anc_clockoffset[i] * (FREQ_OFFSET_MULTIPLIER * HERTZ_TO_PPM_MULTIPLIER_CHAN_2 / 1.0e6) ; +#else + clockOffsetRatio = anc_clockoffset[i] * (FREQ_OFFSET_MULTIPLIER * HERTZ_TO_PPM_MULTIPLIER_CHAN_5 / 1.0e6) ; +#endif + rtd_init = tag_resprx[i] - poll_tx_ts&0xffffffff; + rtd_resp = anc_resptx[i] - anc_pollrx[i]; + tof = ((rtd_init - rtd_resp * (1 - clockOffsetRatio)) / 2.0) * DWT_TIME_UNITS; + distance = tof * SPEED_OF_LIGHT; + if(distance>-10&&distance<1000) + { + nearbase_distlist[i] = distance*100+anc_distoffset[i]; + } else { + nearbase_distlist[i] = 0x1ffff; + } + } else { + nearbase_distlist[i] = 0x1ffff; + } + } } u32 last_mindist_slavebaseid; -- Gitblit v1.9.3