zhyinch
2019-11-26 3a5a4a7ac4e8804ea9cc8d20c3f1d1c04ca699a4
Ô´Âë/ºËÐİå/Src/application/dw_app.c
@@ -21,7 +21,7 @@
static uint8_t tx_sync_msg[14] = {0};
static uint8_t tx_final_msg[60] = {0};
static uint8_t tx_resp_msg[22] = {0};
static uint8_t tx_near_msg[32] = {0};
static uint8_t tx_near_msg[80] = {0};
static uint32_t frame_seq_nb = 0;   
static uint32_t status_reg = 0;
@@ -326,8 +326,8 @@
   memcpy(&tx_near_msg[NEARBASEID_INDEX],&nearbaseid_list,nearbase_num*2);
   tx_near_msg[MESSAGE_TYPE_IDX] = NEAR_POLL;   
   memcpy(&tx_near_msg[ANCHOR_ID_IDX],&mainbase_id,2);   
   dwt_writetxdata(sizeof(tx_near_msg), tx_near_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
   dwt_writetxfctrl(sizeof(tx_near_msg), 0);//设置超宽带发送数据长度
   dwt_writetxdata(24, tx_near_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
   dwt_writetxfctrl(24, 0);//设置超宽带发送数据长度
   dwt_starttx(DWT_START_TX_IMMEDIATE | DWT_RESPONSE_EXPECTED);//开启发送,发送完成后等待一段时间开启接收,等待时间在dwt_setrxaftertxdelay中设置
   neartimout_timer=0;
@@ -353,7 +353,6 @@
                        resp_rx_ts = get_rx_timestamp_u64();                              //获得RESPONSE接收时间T4   
                        recbase_num++;
                        memcpy(&rec_nearbaseid,&rx_buffer[ANCHOR_ID_IDX],2);
                        rec_nearbasepos=FindNearBasePos(rec_nearbaseid);
                        if(rec_nearbaseid==mainbase_id)
                        {
                           //时间同步
@@ -378,13 +377,14 @@
                           dwt_setdelayedtrxtime(final_tx_time);//设置final包发送时间T5
                           final_tx_ts = (((uint64_t)(final_tx_time & 0xFFFFFFFE)) << 8) + TX_ANT_DLY;//final包实际发送时间是计算时间加上发送天线delay
                           final_msg_set_ts(&tx_near_msg[FINAL_MSG_POLL_TX_TS_IDX], poll_tx_ts);//将T1,T4,T5写入发送数据
                           final_msg_set_ts(&tx_near_msg[FINAL_MSG_RESP_RX_TS_IDX], resp_rx_ts);
                           final_msg_set_ts(&tx_near_msg[FINAL_MSG_RESP_RX_NEARBASE_IDX], resp_rx_ts);
                           final_msg_set_ts(&tx_near_msg[FINAL_MSG_FINAL_TX_TS_IDX], final_tx_ts);
                           tx_near_msg[MESSAGE_TYPE_IDX]=NEAR_FINAL;
                           dwt_writetxdata(sizeof(tx_near_msg), tx_near_msg, 0);//将发送数据写入DW1000
                           dwt_writetxfctrl(sizeof(tx_near_msg), 0);//设定发送数据长度
                           dwt_writetxdata(28+nearbase_num*4, tx_near_msg, 0);//将发送数据写入DW1000
                           dwt_writetxfctrl(28+nearbase_num*4, 0);//设定发送数据长度
                           result=dwt_starttx(DWT_START_TX_DELAYED);//设定为延迟发送         
                        }else{
                           rec_nearbasepos=FindNearBasePos(rec_nearbaseid);
                           final_msg_set_ts(&tx_near_msg[FINAL_MSG_RESP_RX_NEARBASE_IDX+rec_nearbasepos*4], resp_rx_ts);                        
                           memcpy(&nearbase_distlist[rec_nearbasepos],&rx_buffer[DIST_IDX],4);
                           dwt_writetxdata(sizeof(tx_near_msg), tx_near_msg, 0);//将发送数据写入DW1000
@@ -599,8 +599,8 @@
         memcpy(&tx_near_msg[DIST_IDX], &tagdist_list[taglist_pos], 4);
         tx_near_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE;
         dwt_writetxdata(sizeof(tx_near_msg), tx_near_msg, 0);//写入发送数据
         dwt_writetxfctrl(sizeof(tx_near_msg), 0);//设定发送长度
         dwt_writetxdata(24, tx_near_msg, 0);//写入发送数据
         dwt_writetxfctrl(24, 0);//设定发送长度
         result = dwt_starttx(DWT_START_TX_DELAYED | DWT_RESPONSE_EXPECTED);//延迟发送,等待接收
         battary = rx_buffer[BATTARY_IDX];