| | |
| | | double Ra, Rb, Da, Db; |
| | | int64_t tof_dtu; |
| | | u32 errortimes,goodtimes; |
| | | u8 tagpossend_flag; |
| | | u8 Anchor_RecNearPoll(u8 ancrec_nearbasepos) //0 mainbase 1 first near_base |
| | | { |
| | | |
| | |
| | | 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) |
| | | { |
| | | memcpy(&tx_nearresp_msg[TAGPOS_INDEX],&tagpos[taglist_pos],16); |
| | | tagpossend_flag = 1; |
| | | }else{ |
| | | tagpossend_flag = 0; |
| | | } |
| | | if(new_tagid) |
| | | { |
| | | tagdist_list[taglist_pos]=0x1ffff; |
| | |
| | | if(finalsend == 0) |
| | | { |
| | | memcpy(&tx_nearresp_msg[MAXRANGE_DISTANCE],&g_com_map[MAXRANGDIST_INDEX],2); |
| | | dwt_writetxdata(28, tx_nearresp_msg, 0);//åå
¥åéæ°æ® |
| | | dwt_writetxfctrl(28, 0);//设å®åéé¿åº¦ |
| | | dwt_writetxdata(28+tagpossend_flag*16, tx_nearresp_msg, 0);//д???????? |
| | | dwt_writetxfctrl(28+tagpossend_flag*16, 0);//?Ú
??????? |
| | | } |
| | | |
| | | // if(remotesend_state&&tag_id_recv==configremotetagID) |
| | |
| | | g_Tagdist[taglist_pos]=hex_dist; |
| | | signalpower_list[taglist_pos] = ((uint8_t)firstpath_power<<8)|(uint8_t)((rx_power-firstpath_power)*10); |
| | | // #ifndef USART_INTEGRATE_OUTPUT |
| | | // usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | // usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | | // usart_send[4] = frame_seq_nb2;//æ°æ®æ®µé¿åº¦ |
| | | // memcpy(&usart_send[5],&tag_id_recv,2); |
| | | // memcpy(&usart_send[7],&dev_id,2); |
| | | // memcpy(&usart_send[9],&tagdist_list[taglist_pos],4); |
| | | // usart_send[13] = battary; |
| | | // usart_send[14] = button; |
| | | // usart_send[15] = firstpath_power; |
| | | // usart_send[16] = (rx_power-firstpath_power)*10; |
| | | // usart_send[17] = tag_frequency; |
| | | // usart_send[18] = tag_slotpos; |
| | | // checksum = Checksum_u16(&usart_send[2],17); |
| | | // memcpy(&usart_send[19],&checksum,2); |
| | | // // UART_PushFrame(usart_send,21); |
| | | usart_send[2] = 1;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 17;//æ°æ®æ®µé¿åº¦ |
| | | usart_send[4] = frame_seq_nb2;//æ°æ®æ®µé¿åº¦ |
| | | memcpy(&usart_send[5],&tag_id_recv,2); |
| | | memcpy(&usart_send[7],&dev_id,2); |
| | | memcpy(&usart_send[9],&tagdist_list[taglist_pos],4); |
| | | usart_send[13] = battary; |
| | | usart_send[14] = button; |
| | | usart_send[15] = firstpath_power; |
| | | usart_send[16] = (rx_power-firstpath_power)*10; |
| | | usart_send[17] = tag_frequency; |
| | | usart_send[18] = tag_slotpos; |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |
| | | //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); |
| | |
| | | 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 ) |
| | | { |
| | | usart_send[2] = 0x0c;//æ£å¸¸æ¨¡å¼ |
| | | usart_send[3] = 15+8*(rec_nearbase_num+1);//æ°æ®æ®µé¿åº¦ |