| | |
| | | NEARPOLL, |
| | | }tag_state=GETNEARMSG; |
| | | static dwt_config_t config = { |
| | | 2, /* Channel number. */ |
| | | 3, /* Channel number. */ |
| | | DWT_PRF_64M, /* Pulse repetition frequency. */ |
| | | DWT_PLEN_64, /* Preamble length. */ |
| | | DWT_PLEN_128, /* Preamble length. */ |
| | | DWT_PAC8, /* Preamble acquisition chunk size. Used in RX only. */ |
| | | 9, /* TX preamble code. Used in TX only. */ |
| | | 9, /* RX preamble code. Used in RX only. */ |
| | |
| | | static uint8_t tx_final_msg[60] = {0}; |
| | | static uint8_t tx_resp_msg[22] = {0}; |
| | | static uint8_t tx_nearpoll_msg[80] = {0}; |
| | | static uint8_t tx_nearresp_msg[80] = {0}; |
| | | static uint8_t tx_nearresp_msg[90] = {0}; |
| | | static uint8_t tx_nearfinal_msg[80] = {0}; |
| | | |
| | | static uint8_t tx_near_msg[80] = {0}; |
| | |
| | | } |
| | | uint32_t time_monitor[10]; |
| | | extern uint16_t configremotetagID; |
| | | extern u8 remotetag_paralen; |
| | | extern u8 remotetag_paralen,userdatasend_flag[TAG_NUM_IN_SYS]; |
| | | u8 finalsend=0; |
| | | u16 signalpower_list[TAG_NUM_IN_SYS]; |
| | | uint32_t poll_tx_ts, resp_rx_ts, final_tx_ts; |
| | |
| | | dwt_setrxaftertxdelay(RESP_TX_TO_FINAL_RX_DLY_UUS+(rec_nearbase_num+1-ancrec_nearbasepos)*DELAY_BETWEEN_TWO_FRAME_UUS);//设置åé宿åå¼å¯æ¥æ¶å»¶è¿æ¶é´ |
| | | dwt_setrxtimeout(FINAL_RX_TIMEOUT_UUS);//æ¥æ¶è¶
æ¶æ¶é´ |
| | | //dwt_readdiagnostics(&d1); |
| | | if(tagpos[taglist_pos].tagid==tag_id_recv) |
| | | if(tagpos[taglist_pos].tagid==tag_id_recv&&userdatasend_flag[taglist_pos] == 1) |
| | | { |
| | | memcpy(&tx_nearresp_msg[TAGPOS_INDEX],&tagpos[taglist_pos],16); |
| | | memcpy(&tx_nearresp_msg[TAGPOS_INDEX],&tagpos[taglist_pos],tagpos[taglist_pos].datalen+3); |
| | | tagpossend_flag = 1; |
| | | }else{ |
| | | tagpossend_flag = 0; |
| | |
| | | memcpy(&tx_nearresp_msg[ANC_SIGNALPOWER],&signalpower_list[taglist_pos],2); |
| | | tx_nearresp_msg[MAINBASE_INDEX]=flag_syncbase; |
| | | tx_nearresp_msg[MESSAGE_TYPE_IDX]=NEAR_RESPONSE; |
| | | tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate; |
| | | //tx_nearresp_msg[MOTORSTATE_INDEX]=(remotesend_state<<4)|motorstate; |
| | | waittagconfig_reponse=0; |
| | | finalsend = 0; |
| | | if(pwtag.remain_time>0) |
| | |
| | | if(finalsend == 0) |
| | | { |
| | | memcpy(&tx_nearresp_msg[MAXRANGE_DISTANCE],&g_com_map[MAXRANGDIST_INDEX],2); |
| | | dwt_writetxdata(28+tagpossend_flag*16, tx_nearresp_msg, 0);//д???????? |
| | | dwt_writetxfctrl(28+tagpossend_flag*16, 0);//?Ú
??????? |
| | | dwt_writetxdata(28+tagpossend_flag*(tagpos[taglist_pos].datalen+3), tx_nearresp_msg, 0);//д???????? |
| | | dwt_writetxfctrl(28+tagpossend_flag*(tagpos[taglist_pos].datalen+3), 0);//?Ú
??????? |
| | | } |
| | | |
| | | // if(remotesend_state&&tag_id_recv==configremotetagID) |
| | |
| | | LED0_BLINK; //æ¯æå䏿¬¡é讯åéªç䏿¬¡ |
| | | dis_after_filter=dist_cm; |
| | | hex_dist = dist_cm+(int16_t)g_com_map[DIST_OFFSET]; |
| | | |
| | | userdatasend_flag[taglist_pos] =0; |
| | | if(hex_dist>-1000&&hex_dist<200000) |
| | | { |
| | | g_flag_Taggetdist[taglist_pos]=0; |
| | |
| | | usart_send[18] = tag_slotpos; |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | UART_PushFrame(usart_send,21); |
| | | //UART_PushFrame(usart_send,21); |
| | | // #else |
| | | // memcpy(&usart_send_anc[4+6*anc_report_num],&tag_id_recv,2); |
| | | // memcpy(&usart_send_anc[6+6*anc_report_num],&tagdist_list[taglist_pos],4); |
| | |
| | | { |
| | | uint16_t checksum; |
| | | case DISCOVERPOLL: |
| | | if (anchor_type == rx_buffer[ANCHOR_ID_IDX]) |
| | | if (anchor_type == rx_buffer[ANCHOR_ID_IDX]&&g_com_map[NEARSWITCH_DISTANCE_INDEX] != 0) |
| | | { |
| | | taglist_pos=CmpTagInList(tag_id_recv); |
| | | if(taglist_pos==taglist_num) |
| | |
| | | } |
| | | |
| | | } |
| | | if(i==MAX_REGTAGNUM) |
| | | if(i==MAX_REGTAGNUM&&g_com_map[NEARSWITCH_DISTANCE_INDEX] != 0) |
| | | { |
| | | dwt_readdiagnostics(&d1); |
| | | LOS(&d1); |
| | |
| | | memcpy(&recnearbaselist_id,&rx_buffer[NEARBASEID_INDEX],rec_nearbase_num*2); |
| | | memcpy(&recnearbaselist_dist,&rx_buffer[NEARBASEID_INDEX+rec_nearbase_num*2],rec_nearbase_num*4+4); |
| | | memcpy(&rec_taganc_signalpower_list,&rx_buffer[NEARBASEID_INDEX+rec_nearbase_num*6+4],rec_nearbase_num*2+2); |
| | | // if(anc_id_recv == dev_id ) |
| | | if(anc_id_recv == dev_id||g_com_map[OUTPUTALLNEARPOLLMSG] == 1 ) |
| | | { |
| | | usart_send[2] = 0x0c;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[2] = 0x0c;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 15+8*(rec_nearbase_num+1);//æ°æ®æ®µé¿åº¦ |
| | | memcpy(&usart_send[4],&tag_id_recv,2); |
| | | usart_send[6] = rx_buffer[SEQUENCE_IDX]; |
| | |
| | | |
| | | checksum = Checksum_u16(&usart_send[2],23+8*rec_nearbase_num); |
| | | memcpy(&usart_send[25+8*rec_nearbase_num],&checksum,2); |
| | | // UART_PushFrame(usart_send,27+8*rec_nearbase_num); |
| | | UART_PushFrame(usart_send,27+8*rec_nearbase_num); |
| | | // UART_CheckSend(); |
| | | |
| | | timm++; |