From f8013e4f432b323dfc3e3725a62858e73176742a Mon Sep 17 00:00:00 2001 From: zhangbo <zhangbo@qq.com> Date: 星期五, 01 十一月 2024 15:16:32 +0800 Subject: [PATCH] 更换了新的sdk,测试了实际的uwb测距 --- keil/include/components/app/src/uwb_trx.c | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/keil/include/components/app/src/uwb_trx.c b/keil/include/components/app/src/uwb_trx.c index 9a9ce90..0a594cc 100644 --- a/keil/include/components/app/src/uwb_trx.c +++ b/keil/include/components/app/src/uwb_trx.c @@ -127,8 +127,9 @@ ind->hdr.event = UWB_RX_DONE_MSG; ind->phy_timer_count = rx->timestamp; ind->status = rx->err_code; - ind->rssi = rx->rssi; - ind->snr = rx->snr; + // ind->rssi = rx->rssi; + ind->rssi = correct_rssi(rx->rssi); + ind->snr = correct_snr(rx->snr); if (rx->err_code == UWB_RX_OK) { @@ -144,16 +145,12 @@ } ind->length = rx->pkt_len; -#if RANGING_EN - int64_t timestamp = ranging_rx_time(rx); - ind->timestamp_frac = timestamp & 0x1ff; - ind->timestamp_int = (uint32_t)(timestamp >> 9); - +#if CSI_EN if (ranging_debug_csi_en_get()) { uint8_t frame_idx = 0; debug_csi.frame_idx = frame_idx; - debug_csi.rframe_idx = frame_idx; + debug_csi.frame_idx = frame_idx; uint32_t val = REG_READ(0x40003050); debug_csi.frame[frame_idx].rf_gain = (val & 0x07); @@ -165,12 +162,18 @@ { debug_csi.frame[frame_idx].rssi = ind->rssi; debug_csi.frame[frame_idx].snr = ind->snr; - + debug_csi.frame[frame_idx].channel_power = REG_READ(0x40002064); + debug_csi.frame[frame_idx].noise_power = REG_READ(0x40002078); dump_preamble_cir(frame_idx, 128); dump_sts_cir(frame_idx); } } #endif +#if RANGING_EN || CSI_EN + int64_t timestamp = ranging_rx_time(rx); + ind->timestamp_frac = timestamp & 0x1ff; + ind->timestamp_int = (uint32_t)(timestamp >> 9); +#endif } // Send the message -- Gitblit v1.9.3