| | |
| | | { |
| | | memcpy(&minid, &rx_buffer[ANCHOR_ID_IDX], 4); |
| | | tag_state=GETNEARMSG; |
| | | trygetnearmsg_times=5; |
| | | trygetnearmsg_times=10*tag_frequency; |
| | | mindist=temp_dist; |
| | | } |
| | | if(result==0) |
| | |
| | | memcpy(&nearbase_switchdistlist[rec_nearbasepos],&rx_buffer[NR_NEARSWITCH_DISTANCE],2); |
| | | nearbase_distlist[rec_nearbasepos]=temp_dist; |
| | | final_msg_set_ts(&tx_near_msg[FINAL_MSG_RESP_RX_NEARBASE_IDX+(rec_nearbasepos)*4], resp_rx_ts); |
| | | if(temp_dist<nearbase_switchdistlist[rec_nearbasepos]&&nearbase_switchdistlist[rec_nearbasepos]!=0&&temp_dist!=0) |
| | | if(temp_dist<nearbase_switchdistlist[rec_nearbasepos]&&nearbase_switchdistlist[rec_nearbasepos]!=0&&temp_dist>0) |
| | | { |
| | | mainbase_id = rec_nearbaseid; |
| | | tag_state = GETNEARMSG; |
| | |
| | | // mainbase_id = true_nearbase_idlist[0]; |
| | | // tag_state = GETNEARMSG; |
| | | // } |
| | | if(mainbase_lost_count>10) |
| | | if(mainbase_lost_count>10*tag_frequency) |
| | | { |
| | | tag_state = DISCPOLL; |
| | | tag_state = STARTPOLL; |
| | | } |
| | | // for (i=0;i<nearbase_num;i++) |
| | | // { |
| | |
| | | id = dwt_readdevid() ; |
| | | while (DWT_DEVICE_ID != id) |
| | | { |
| | | Dw1000_Init(); |
| | | // Dw1000_Init(); |
| | | id = dwt_readdevid() ; |
| | | } |
| | | switch(tag_state) |
| | |
| | | LED_LG_OFF; |
| | | if(trygetnearmsg_times==0) |
| | | { |
| | | tag_state = DISCPOLL; |
| | | tag_state = STARTPOLL; |
| | | } |
| | | break; |
| | | case NEARPOLL: |