| | |
| | | } |
| | | extern uint8_t heart_upload_time; |
| | | uint16_t count_hexupload; |
| | | extern uint8_t open_gps_time; |
| | | void UWBSendUDPTask(void) |
| | | { |
| | | uint16_t checksum,tempdistarray[20]; |
| | |
| | | memcpy(&usart_send[17+taglist_num*4],&anchordata_bat,taglist_num); |
| | | checksum = Checksum_u16(&usart_send[2],15+5*taglist_num); |
| | | memcpy(&usart_send[17+5*taglist_num],&checksum,2); |
| | | if(lounei_flag==0&&heart_upload_time%UPLOAD_4G_TIME==0) |
| | | if((heart_upload_time%UPLOAD_4G_TIME==0&&lounei_flag==0&&open_gps_time>120)||(open_gps_time%UPLOAD_4G_TIME==0&&lounei_flag==0&&open_gps_time<120)) |
| | | { |
| | | HexToAsciiSendUDP(usart_send,19+5*taglist_num); |
| | | count_hexupload++; |
| | |
| | | //} |
| | | //enumwltagstate wltag_state=RANGE; |
| | | uint32_t wltag_statetimer,wltag_uwbtimer; |
| | | extern uint16_t uwb_time_count; |
| | | int uwb_app_poll(void) |
| | | { |
| | | switch(wltag_state) |
| | | { |
| | | |
| | | case RANGE: |
| | | // time_flag=HIDO_TimerGetTick()-wltag_uwbtimer; |
| | | if(HIDO_TimerGetTick()-wltag_uwbtimer>4&&uwb_rx_flag==0) |
| | | { |
| | | wltag_uwbtimer = HIDO_TimerGetTick(); |
| | | OpenUWB(); |
| | | |
| | | } |
| | | else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1) |
| | | switch(uwb_time_count) |
| | | { |
| | | // time_flag=HIDO_TimerGetTick()-wltag_uwbtimer; |
| | | wltag_uwbtimer = HIDO_TimerGetTick(); |
| | | CloseUWB(); |
| | | case 1: |
| | | CloseUWB(); |
| | | break; |
| | | case 5: |
| | | OpenUWB(); |
| | | uwb_time_count=0; |
| | | break; |
| | | } |
| | | if(uwb_losttimer>g_com_map[UWB_RNAGE_TIME]) |
| | | { |
| | | wltag_statetimer = HIDO_TimerGetTick(); |
| | | if(uwb_rx_flag==0)//若要切换到搜索模式时没有开启则开启UWB |
| | | { |
| | | OpenUWB(); |
| | | } |
| | | wltag_state = SEARCH; |
| | | } |
| | | break; |
| | | case SEARCH: |
| | | if(HIDO_TimerGetTick()-wltag_statetimer>1) |
| | | { |
| | | wltag_statetimer = HIDO_TimerGetTick(); |
| | | wltag_state = CLOSE; |
| | | CloseUWB(); |
| | | |
| | | } |
| | | break; |
| | | case CLOSE: |
| | | if(HIDO_TimerGetTick()-wltag_statetimer>g_com_map[UWB_WAIT_TIME]) |
| | | { |
| | | wltag_statetimer = HIDO_TimerGetTick(); |
| | | wltag_state = SEARCH; |
| | | OpenUWB(); |
| | | } |
| | | break; |
| | | } |
| | | UWBIdleTask(); |
| | | } |
| | | uint8_t in_the_room_flag=0; |