From 8dd2c20ddb32d065b877d66394e52a73c0376838 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期二, 13 五月 2025 09:39:54 +0800 Subject: [PATCH] 1.72,加入拉高lora的cs脚,兼容带lora的免布线基站 --- Src/application/dw_app.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c index 0ac5c30..2cdd395 100644 --- a/Src/application/dw_app.c +++ b/Src/application/dw_app.c @@ -70,8 +70,15 @@ #define FINAL_MSG_RESP_RX_TS_IDX 14 #define FINAL_MSG_FINAL_TX_TS_IDX 18 #define FINAL_MSG_TS_LEN 4 + +//#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_64, /* Preamble length. */ DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ @@ -338,7 +345,11 @@ { // exsistbase_list[i]--; - clockOffsetRatio = anc_clockoffset[i] * (FREQ_OFFSET_MULTIPLIER * HERTZ_TO_PPM_MULTIPLIER_CHAN_5 / 1.0e6) ; +#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; rtd_resp = anc_resptx[i] - anc_pollrx[i]; tof = ((rtd_init - rtd_resp * (1 - clockOffsetRatio)) / 2.0) * DWT_TIME_UNITS; @@ -346,7 +357,7 @@ if(distance>-10&&distance<1000) nearbase_distlist[i] = distance*100+anc_distoffset[i]; }else{ - // nearbase_distlist[i] = 0x1ffff; + nearbase_distlist[i] = 0x1ffff; } } @@ -671,6 +682,7 @@ } u8 regpoll_count; u32 id; +uint32_t temp23; void Tag_App(void)//发送模式(TAG标签) { @@ -685,6 +697,11 @@ printf("UWB芯片ID错误"); break; } + } + temp23 = dwt_read32bitreg(CHAN_CTRL_ID) ; + if(temp23!=0x4A7A0055&&temp23!=0x4A7A0022) //通道状态监听,不正常重启。 + { + NVIC_SystemReset(); } delay_us(100); g_Resttimer=0; @@ -702,6 +719,10 @@ Registor_Poll(); } } + if(freqlost_count>FREQ_LOST_RESTART_TIME) //1个小时无测距 设备重启一次 + { + NVIC_SystemReset(); + } NearPoll(); dwt_entersleep(); bat_percent=Get_VDDVlotage(); -- Gitblit v1.9.3