WXK
2025-02-11 e328ebef585cea2351b37117b2d5ac4978ecd3c0
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