| | |
| | | change_base_count=0; |
| | | } |
| | | } |
| | | u8 anclost_times=0; |
| | | void NearPoll(void) |
| | | { |
| | | static u8 mainbase_lost_count=0,flag_finalsend; |
| | |
| | | //////////////////////////////////æ¶é´åæ¥ |
| | | memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2); |
| | | memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2); |
| | | memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2); |
| | | // memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2); |
| | | tmp_time=tmp_time+450; |
| | | if(tmp_time>999) |
| | | { |
| | |
| | | {sync_timer=0;} |
| | | } |
| | | TIM3->CNT=tmp_time; |
| | | if(tagslotpos>max_slotpos) |
| | | tagslotpos=tagslotpos%(max_slotpos+1); |
| | | tyncpoll_time=(tagslotpos-1)*slottime; |
| | | // if(tagslotpos>max_slotpos) |
| | | // tagslotpos=tagslotpos%(max_slotpos+1); |
| | | // tyncpoll_time=(tagslotpos-1)*slottime; |
| | | //////////////////////////// |
| | | mainbase_lost_count=0; |
| | | flag_finalsend=1; |
| | |
| | | tag_state=DISCPOLL; |
| | | } |
| | | NearAncSelect(); |
| | | // if(result==0) |
| | | // {while (!(dwt_read32bitreg(SYS_STATUS_ID) & SYS_STATUS_TXFRS))//䏿æ¥è¯¢è¯çç¶æç´å°åé宿 |
| | | // { }; |
| | | // |
| | | // } |
| | | // else |
| | | // { |
| | | if(recbase_num<g_com_map[MIN_REPORT_ANC_NUM] ) |
| | | { |
| | | anclost_times++; |
| | | if(anclost_times>3) |
| | | { |
| | | tagslotpos=poll_tx_ts%(max_slotpos+1); |
| | | } |
| | | }else{ |
| | | anclost_times=0; |
| | | } |
| | | |
| | | dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR); |
| | | // } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | break; |
| | | case NEARPOLL: |
| | | GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET); |
| | | //GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_SET); |
| | | NearPoll(); |
| | | GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET); |
| | | //GPIO_WriteBit(EU_TX_GPIO, EU_RX_PIN, Bit_RESET); |
| | | break; |
| | | } |
| | | } |