WXK
2025-03-14 63bf8ea65ca11349d5fae93580f91a87d3633dba
keil/uwb_app.c
@@ -37,7 +37,7 @@
extern uint8_t group_id;
static uint16_t anc_id_recv,tag_id_recv;
static int16_t rec_antdelay;
extern uint32_t dev_id;
extern uint16_t dev_id;
static uint16_t taglist_pos,tmp_time;
extern uint16_t tag_frequency;
extern uint16_t disoffset;
@@ -137,7 +137,7 @@
#ifdef DW1000
static struct mk_uwb_configure config = {
    .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX),
    .phy_cfg.ch_num = 5,                      /* Channel number.                           */
    .phy_cfg.ch_num = 9,                      /* Channel number.                           */
    .phy_cfg.code_index = 9,                  /* TRX preamble code                         */
    .phy_cfg.mean_prf = MEAN_PRF_64M,         /* Mean prf 64/128/256M                      */
    .phy_cfg.data_bit_rate = DATA_BR_6M8,     /* Data rate 6.8M                            */
@@ -371,6 +371,7 @@
uint32_t start_receive_count,end_receive_count,poll_timeout,current_count,temp_resp;
 uint16_t anchordata_id[TAG_NUM_IN_SYS],anchordata_dist[TAG_NUM_IN_SYS];
static uint8_t anchordata_bat[TAG_NUM_IN_SYS];
static int8_t anchor_rssi[TAG_NUM_IN_SYS];
uint8_t anchordata_num = 0;
static int16_t tagdist_list[TAG_NUM_IN_SYS];
uint16_t random_time;
@@ -488,6 +489,7 @@
            tagid_list[j]=tagid_list[i];
            tagdist_list[j] = tagdist_list[i];
                  anchordata_bat[j]=anchordata_bat[i];//电量随之更新
            anchor_rssi[j]=anchor_rssi[i];
            tagofflinetime[j++]=tagofflinetime[i];
        }
      }
@@ -626,15 +628,19 @@
            {
                uint16_t id,dist;
                uint8_t bat;
                int8_t rssi1;
                id = tagid_list[j];
                dist = tagdist_list[j];
                bat = anchordata_bat[j];
                rssi1=anchor_rssi[j];
                tagid_list[j] = tagid_list[j+1];
                tagdist_list[j] = tagdist_list[j+1];
                anchordata_bat[j] = anchordata_bat[j+1];
                anchor_rssi[j] = anchor_rssi[j+1];
                tagid_list[j+1] = id;
                tagdist_list[j+1] = dist;
                anchordata_bat[j+1] = bat;
                anchor_rssi[j+1] = rssi1;
            }
        }
    
@@ -755,6 +761,7 @@
                                    Anchor_RecNearPoll(i);
                                    tagdist_list[taglist_pos]=rec_ancdistlist[i];
                                    anchordata_bat[taglist_pos] = battary;//保存该基站电量
                                                anchor_rssi[taglist_pos]=rssi;
                                    if(taglist_pos==taglist_num)// taglist_pos==taglist_num 说明这个基站不在当前列表中
                                    {   //tempid==dev_id 说明基站下发测距报文有这个标签的信息
                                          taglist_num++;          //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况