WXK
2023-11-01 eddac77c8fa85acccbf6eeff48b1ff760c70843a
Src/application/dw_app.c
@@ -89,7 +89,7 @@
   9,               /* RX preamble code. Used in RX only. */
   1,               /* Use non-standard SFD (Boolean) */
   DWT_BR_6M8,      /* Data rate. */
   DWT_PHRMODE_STD, /* PHY header mode. */
   DWT_PHRMODE_EXT, /* PHY header mode. */
   (129 + 8 - 8)    /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
};
static uint8_t tx_poll_msg[20] = {0};
@@ -851,6 +851,7 @@
extern uint16_t taglist_num;
extern int32_t tagdist_list[TAG_NUM_IN_SYS];
uint16_t nearbase_taglist_num;
extern uint8_t uwb_tx[300];
void NearPoll(void)
{
   
@@ -886,6 +887,8 @@
   tx_near_msg[BUTTON_IDX] = userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5;
   tx_near_msg[SEQUENCE_IDX] = frame_seq_nb;
    tx_near_msg[SEQUENCEH_IDX] = (frame_seq_nb++)>>8;
    if(taglist_num>10)
    {taglist_num=10;}
    nearbase_taglist_num=nearbase_num+taglist_num;
   tx_near_msg[NEARBASENUM_INDEX] = nearbase_taglist_num;
   memcpy(&tx_near_msg[NEARBASEID_INDEX],&nearbaseid_list,nearbase_num*2);
@@ -909,6 +912,10 @@
   memcpy(&tx_near_msg[ANCHOR_ID_IDX],&mainbase_id,2);   
   dwt_writetxdata(29+8*nearbase_taglist_num, tx_near_msg, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
   dwt_writetxfctrl(29+8*nearbase_taglist_num, 0);//设置超宽带发送数据长度
//       dwt_writetxdata(280, uwb_tx, 0);//将Poll包数据传给DW1000,将在开启发送时传出去
//   dwt_writetxfctrl(282, 0);//设置超宽带发送数据长度
            current_count=HAL_LPTIM_ReadCounter(&hlptim1);
      
      while(current_count<poll_startcount||current_count>poll_startcount+16384)
@@ -933,7 +940,7 @@
   flag_getresponse=0;
   start_count=HAL_LPTIM_ReadCounter(&hlptim1);
   recbase_num=0;
   timeout=ceil((float)nearbase_num*SLOT_SCALE)+3;
   timeout=ceil((float)nearbase_taglist_num*SLOT_SCALE)+3;
   end_count=start_count+(timeout<<5);
   if(end_count>=32768)
   {end_count-=32768;}
@@ -1333,6 +1340,7 @@
   }
     userkey_state = !GET_USERKEY;
           dwt_forcetrxoff();
//       Dw1000_Init();
       dwt_setinterrupt(  DWT_INT_RFCG | (DWT_INT_ARFE | DWT_INT_RFSL | DWT_INT_SFDT | DWT_INT_RPHE | DWT_INT_RFCE | DWT_INT_RFTO | DWT_INT_RXPTO), 1);
      dwt_setrxtimeout(0);//设定接收超时时间,0位没有超时时间
        dwt_rxenable(0);