| | |
| | | #define RANGING_PERIOD_MS (1000) |
| | | |
| | | /* This is the delay from Frame RX POLL frame to send RESP Frame */ |
| | | #define POLL_RX_TO_RESP_TX_DLY_US 550U //yuan550极限 |
| | | #define POLL_RX_TO_RESP_TX_DLY_US 3500U //yuan550极限 |
| | | |
| | | #define RESP_TX_TO_FINAL_RX_DLY_US 500U |
| | | |
| | |
| | | .phy_cfg.sts_segnum = STS_SEGNUM_BPRF_1, /* Number of STS segments in the frame */ |
| | | .phy_cfg.sts_seglen = STS_SEGLEN_BPRF_64, /* Number of symbols in an STS segment */ |
| | | .phy_cfg.rx_ant_id = UWB_RX_ANT_3, /* UWB RX antenna port */ |
| | | }; |
| | | #elif defined BIT_110K_MODE |
| | | static struct mk_uwb_configure config = { |
| | | .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX), |
| | | .phy_cfg.ch_num = 5, /* Channel number. */ |
| | | .phy_cfg.code_index = 3, /* TRX preamble code */ |
| | | .phy_cfg.mean_prf = MEAN_PRF_16M, /* Mean prf 64/128/256M */ |
| | | .phy_cfg.data_bit_rate = DATA_BR_110K, /* Data rate 6.8M */ |
| | | .phy_cfg.sync_sym = PREAM_LEN_1024, /* Preamble duration, length of preamble 128 */ |
| | | .phy_cfg.sfd_sym = NSFD_64, /* Identifier for SFD sequence */ |
| | | .phy_cfg.ranging_bit = 1, /* ranging bit set 1 */ |
| | | .phy_cfg.trx_mode = TRX_MODE_15_4A, /* IEEE802.15.4z - BPRF mode */ |
| | | .phy_cfg.sts_pkt_cfg = STS_PKT_CFG_0, /* SP0 Frame */ |
| | | .phy_cfg.sts_segnum = STS_SEGNUM_BPRF_1, /* Number of STS segments in the frame */ |
| | | .phy_cfg.sts_seglen = STS_SEGLEN_BPRF_64, /* Number of symbols in an STS segment */ |
| | | .phy_cfg.rx_ant_id = UWB_RX_ANT_3, /* UWB RX antenna port */ |
| | | }; |
| | | #endif |
| | | |
| | |
| | | { |
| | | tagid_list[j]=tagid_list[i]; |
| | | tagdist_list[j] = tagdist_list[i]; |
| | | anchordata_bat[j]=anchordata_bat[i];//电量随之更新 |
| | | tagofflinetime[j++]=tagofflinetime[i]; |
| | | } |
| | | } |
| | |
| | | &&!((end_receive_count-current_count_calibration<=MS_TO_PHY_TIMER_COUNT(200))||(end_receive_count+(UINT32_MAX-current_count_calibration)<=MS_TO_PHY_TIMER_COUNT(200)))) |
| | | { |
| | | start_receive_count_calibration=current_count_calibration;//更新开始时间 |
| | | // MotorPoll(); |
| | | |
| | | |
| | | if(secondtask_search_count++%2==0) |
| | | { |
| | |
| | | { |
| | | uwb_rx_force_off(1); |
| | | uwb_rx_flag=0; |
| | | LOG_INFO(TRACE_MODULE_APP,"关闭uwb_rx\r\n"); |
| | | //LOG_INFO(TRACE_MODULE_APP,"关闭uwb_rx\r\n"); |
| | | } |
| | | void OpenUWB(void) |
| | | { |
| | | flag_temp1=uwb_rx(0, 0,range_timeout_us);//提交接收请求 |
| | | uwb_rx_flag=1; |
| | | LOG_INFO(TRACE_MODULE_APP,"打开uwb_rx\r\n"); |
| | | //LOG_INFO(TRACE_MODULE_APP,"打开uwb_rx\r\n"); |
| | | } |
| | | void UWBOneSecondTask(void) |
| | | { |
| | |
| | | // switch(wltag_state) |
| | | // { |
| | | // case RANGE: |
| | | // if(HIDO_TimerGetTick()-wltag_uwbtimer>0&&uwb_rx_flag==0) |
| | | // if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==0) |
| | | // { |
| | | // wltag_uwbtimer = HIDO_TimerGetTick(); |
| | | // OpenUWB(); |
| | | // } |
| | | // else if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==1) |
| | | // else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1) |
| | | // { |
| | | // wltag_uwbtimer = HIDO_TimerGetTick(); |
| | | // CloseUWB(); |
| | |
| | | { |
| | | Anchor_RecNearPoll(i); |
| | | tagdist_list[taglist_pos]=rec_ancdistlist[i]; |
| | | anchordata_bat[taglist_pos] = battary;//保存该基站电量 |
| | | if(taglist_pos==taglist_num)// taglist_pos==taglist_num 说明这个基站不在当前列表中 |
| | | { //tempid==dev_id 说明基站下发测距报文有这个标签的信息 |
| | | taglist_num++; //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况 |
| | | tagid_list[taglist_pos] = tag_id_recv; |
| | | |
| | | } |
| | | break; |
| | | } |