WXK
2025-04-18 52339a8243f5a4ee7f3471d19eae4cc0293c14e1
keil/uwb_app.c
@@ -116,7 +116,7 @@
    uint8_t phy_work_mode; /* PHY_TX / PHY_RX / PHT_TX|PHY_RX */
    struct UWB_CONFIG_T phy_cfg;
};
extern uint8_t uwb_ch;
static struct mk_uwb_configure config = {
    .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX),
    .phy_cfg.ch_num = 5,                      /* Channel number.                           */
@@ -251,6 +251,7 @@
        rssi = rx_report->rssi;
        receive_flag=1;
//        uart_send(UART_ID0, rx_buf,rx_length, NULL);
        gpio_pin_toggle(IO_PIN_4);
        if(rx_buf[MESSAGE_TYPE_IDX]==MBX_POLL)
        {
        Anchor_App();
@@ -317,7 +318,7 @@
//            }
            }
        }
         #ifdef STS_MODE
            valid_sts= sts_valid_check();
      if (valid_sts)
@@ -518,6 +519,11 @@
                //while(mac_is_busy());
                gpio_pin_clr(SCL_PIN);
                cmd_flag=1;
                if(send_buffer[RW_FLAG_IDX]==0x01)
                {
                delay_ms(100);
                NVIC_SystemReset();
                }
                break;
            }
        }
@@ -654,6 +660,7 @@
        memcpy(&uwbsend[4+taglist_num*2],&tagdist_list,taglist_num*2);
        memcpy(&uwbsend[4+taglist_num*4],&anchordata_version,taglist_num*2);
        uart_send(UART_ID0, uwbsend,taglist_num*6+4, NULL);
        taglist_num=0;
//        for(int i=0;i<anchordata_num;i++)
//        {
//        LOG_INFO(TRACE_MODULE_APP,"当前测距基站ID:%x,距离:%d.\r\n",tagid_list[0],tagdist_list[0]);
@@ -879,6 +886,7 @@
    phy_rx_ant_mode_set(RX_ANT_PORTS_COMBINATION);
   #endif
    // Set calibration parameters
    config.phy_cfg.ch_num=g_com_map[NEARBASE_ID1];
    uwb_calibration_params_set(config.phy_cfg.ch_num);
   #ifndef STS_MODE
   // set advanced parameters