1
yincheng.zhong
2023-02-03 118936b83613caad177797a828358d261f674a4e
Src/application/dw_app.c
@@ -30,6 +30,7 @@
#include "beep.h"
#include "modbus.h"
#define SUPERTAG_GROUP 0xff
#define USART_INTEGRATE_OUTPUT
/*------------------------------------ Marcos ------------------------------------------*/
/* Inter-ranging delay period, in milliseconds. */
@@ -48,12 +49,12 @@
#define POLL_TX_TO_RESP_RX_DLY_UUS 150
/* This is the delay from Frame RX timestamp to TX reply timestamp used for calculating/setting the DW1000's delayed TX function. This includes the
 * frame length of approximately 2.66 ms with above configuration. */
#define RESP_RX_TO_FINAL_TX_DLY_UUS 410
#define RESP_RX_TO_FINAL_TX_DLY_UUS 810
/* Receive response timeout. See NOTE 5 below. */
#define RESP_RX_TIMEOUT_UUS 600
#define DELAY_BETWEEN_TWO_FRAME_UUS 400
#define DELAY_BETWEEN_TWO_FRAME_UUS 600
#define POLL_RX_TO_RESP_TX_DLY_UUS 470
/* This is the delay from the end of the frame transmission to the enable of the receiver, as programmed for the DW1000's wait for response feature. */
@@ -78,7 +79,7 @@
   NEARPOLL,
}tag_state=GETNEARMSG;
static dwt_config_t config = {
   2,               /* Channel number. */
   5,              /* Channel number. */
   DWT_PRF_64M,     /* Pulse repetition frequency. */
   DWT_PLEN_128,    /* Preamble length. */
   DWT_PAC8,        /* Preamble acquisition chunk size. Used in RX only. */
@@ -379,7 +380,7 @@
                     dwt_readrxdata(rx_buffer, frame_len, 0);   //读取接收数据
                     dwt_setrxtimeout(0);//DELAY_BETWEEN_TWO_FRAME_UUS*(nearbase_num+1-recbase_num)+10);//设定接收超时时间,0位没有超时时间
                     dwt_rxenable(0);//打开接收
                     if (rx_buffer[MESSAGE_TYPE_IDX] == NEAR_RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,2)&&rx_buffer[GROUP_ID_IDX]==group_id) //判断接收到的数据是否是response数据
                     if (rx_buffer[MESSAGE_TYPE_IDX] == NEAR_RESPONSE&&!memcmp(&rx_buffer[TAG_ID_IDX],&dev_id,2)&&(group_id == SUPERTAG_GROUP||rx_buffer[GROUP_ID_IDX]==group_id)) //判断接收到的数据是否是response数据
                     {   u16 rec_nearbaseid,rec_nearbasepos;
                        poll_tx_ts = get_tx_timestamp_u64();                              //获得POLL发送时间T1
                        resp_rx_ts = get_rx_timestamp_u64();                              //获得RESPONSE接收时间T4