| | |
| | | #include "board.h" |
| | | #include "lib_aoa.h" |
| | | #include "WS2812.h" |
| | | #include "TCPClient.h" |
| | | |
| | | extern int simple_main(void); |
| | | extern int temp_main(void); |
| | | void Calibration_Time(void); |
| | |
| | | #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 670U //yuan550极限 |
| | | #define POLL_RX_TO_RESP_TX_DLY_US 550U //yuan550极限 |
| | | //#define POLL_RX_TO_RESP_TX_DLY_US 550U //yuan550极限 |
| | | |
| | | #define RESP_TX_TO_FINAL_RX_DLY_US 500U |
| | |
| | | // .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 */ |
| | | //}; |
| | | #ifdef UWB_DW1000_XB |
| | | #ifdef UWB_MK8000_XB |
| | | static struct mk_uwb_configure config = { |
| | | .phy_work_mode = (uint8_t)(PHY_TX | PHY_RX), |
| | | .phy_cfg.ch_num = 5, /* Channel number. */ |
| | |
| | | Anchor_App(); |
| | | if(resp_tx_flag==0) |
| | | { |
| | | #ifdef UWB_CK |
| | | |
| | | OpenUWB(); |
| | | #endif |
| | | |
| | | } |
| | | // #ifdef STS_MODE |
| | | // valid_sts= sts_valid_check(); |
| | |
| | | memcpy(&rx_rpt, rx_report, sizeof(struct MAC_HW_REPORT_T)); |
| | | rx_length = 0; |
| | | receive_error_flag=1; |
| | | #ifdef UWB_CK |
| | | |
| | | OpenUWB(); |
| | | #endif |
| | | |
| | | // OpenUWB();//再次开启UWB接收 |
| | | } |
| | | // CloseUWB(); |
| | |
| | | temp_count= phy_timer_count_get(); |
| | | temp_internal=temp_count; |
| | | resp_tx_num++; |
| | | #ifdef UWB_CK |
| | | |
| | | OpenUWB(); |
| | | #endif |
| | | |
| | | // OpenUWB();//再次开启UWB接收 |
| | | //LOG_INFO(TRACE_MODULE_APP, "poll_rx_num is %d,resp_tx_num is %d\r\n",poll_rx_num,resp_tx_num); |
| | | } |
| | |
| | | checksum = Checksum_u16(&usart_send[2],15+5*taglist_num); |
| | | memcpy(&usart_send[17+5*taglist_num],&checksum,2); |
| | | HexToAsciiSendUDP(usart_send,19+5*taglist_num); |
| | | taglist_num = 0; |
| | | // taglist_num = 0; |
| | | // rxnum=0; |
| | | } |
| | | void UWBIdleTask(void) |
| | |
| | | { |
| | | UWBIdleTask(); |
| | | } |
| | | extern uint8_t uwb_offtime_count; |
| | | int Anchor_App(void) |
| | | { |
| | | uint8_t i; |
| | |
| | | memcpy(rec_ancdistlist,&rx_buf[FZ_NEARBASEID_INDEX+2*rec_nearbase_num],2*rec_nearbase_num); |
| | | memcpy(&rec_antdelay,&rx_buf[FZ_NEARBASEID_INDEX+rec_nearbase_num*4],2); |
| | | uwbled=BLUE; |
| | | uwb_offtime_count=0; |
| | | CountState_t current_state = STATE_SLEEP; |
| | | // for(i=0; i<rec_nearbase_num; i++) |
| | | // { |
| | | // if(rec_ancidlist[i] == dev_id) |
| | |
| | | Anchor_RecNearPoll(i); |
| | | tagdist_list[taglist_pos]=rec_ancdistlist[i]; |
| | | anchordata_bat[taglist_pos] = battary;//保存该基站电量 |
| | | anchor_rssi[taglist_pos]=rssi; |
| | | anchor_rssi[taglist_pos]=rssi; |
| | | if(taglist_pos==taglist_num)// taglist_pos==taglist_num 说明这个基站不在当前列表中 |
| | | { //tempid==dev_id 说明基站下发测距报文有这个标签的信息 |
| | | taglist_num++; //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况 |