| | |
| | | uint32_t range_timeout_us = 2000000;//yuan5000 |
| | | uint8_t flag_temp2,flag_temp1; |
| | | uint16_t uwb_losttimer; |
| | | uint8_t mac_error; |
| | | //uint8_t mac_error; |
| | | uint8_t allow_flag; |
| | | uint8_t resp_tx_flag,poll_rx_error_num; |
| | | uint8_t tag_rssi[TAG_NUM_IN_SYS]; |
| | |
| | | OpenUWB();//再次开启UWB接收 |
| | | //LOG_INFO(TRACE_MODULE_APP, "poll_rx_num is %d,resp_tx_num is %d\r\n",poll_rx_num,resp_tx_num); |
| | | }else{ |
| | | mac_error=1; |
| | | //mac_error=1; |
| | | } |
| | | } |
| | | uint32_t start_receive_count,end_receive_count,poll_timeout,current_count,temp_resp; |
| | |
| | | extern uint32_t tag_id_authorization_list[1024]; |
| | | static uint8_t anchordata_bat[TAG_NUM_IN_SYS]; |
| | | uint8_t anchordata_num = 0; |
| | | static int32_t tagdist_list[TAG_NUM_IN_SYS]; |
| | | static int16_t tagdist_list[TAG_NUM_IN_SYS]; |
| | | uint8_t rssi_quality[TAG_NUM_IN_SYS]; |
| | | uint16_t state_button[TAG_NUM_IN_SYS]; |
| | | uint16_t pressure[TAG_NUM_IN_SYS]; |
| | |
| | | tagid_list[j] = tagid_list[j + 1]; |
| | | tagid_list[j + 1] = temp_id; |
| | | |
| | | //同步交换电量是否授权表和在线时间 |
| | | //同步交换电量 |
| | | uint32_t temp_bat = anchordata_bat[j]; |
| | | anchordata_bat[j]=anchordata_bat[j+1];//电量随之更新 |
| | | anchordata_bat[j+1]=temp_bat; |
| | |
| | | tagofflinetime[j]=tagofflinetime[j+1];//电量随之更新 |
| | | tagofflinetime[j+1]=temp_tag_offlinetime; |
| | | |
| | | //水平角度交换 |
| | | uint16_t temp_tag_azimuth=angle_azimuth[j]; |
| | | angle_azimuth[j]=angle_azimuth[j+1]; |
| | | angle_azimuth[j+1]=temp_tag_azimuth; |
| | | //垂直角度交换 |
| | | uint16_t temp_tag_elevation=angle_elevation[j]; |
| | | angle_elevation[j]=angle_elevation[j+1]; |
| | | angle_elevation[j+1]=temp_tag_elevation; |
| | | //信号强度交换 |
| | | uint8_t rssi_temp=tag_rssi[j]; |
| | | tag_rssi[j]=tag_rssi[j+1]; |
| | | tag_rssi[j+1]=rssi_temp; |
| | | //信号质量交换 |
| | | uint8_t temp_quality=rssi_quality[j]; |
| | | rssi_quality[j]=rssi_quality[j+1]; |
| | | rssi_quality[j+1]=temp_quality; |
| | | //设备状态交换 |
| | | uint16_t temp_state=state_button[j]; |
| | | state_button[j]=state_button[j+1]; |
| | | state_button[j+1]=temp_state; |
| | | //气压交换 |
| | | uint16_t temp_pressure=pressure[j]; |
| | | pressure[j]=pressure[j+1]; |
| | | pressure[j+1]=temp_pressure; |
| | | //包序交换 |
| | | uint8_t seq_temp=tag_seq[j]; |
| | | tag_seq[j]=tag_seq[j+1]; |
| | | tag_seq[j+1]=seq_temp; |
| | | //showbuffer交换 |
| | | uint8_t show_location_temp=show_location[j]; |
| | | show_location[j]=show_location[j+1]; |
| | | show_location[j+1]=show_location_temp; |
| | | // //同步交换授权表 |
| | | // uint8_t temp_tag_authorized = tag_authorized_List[j]; |
| | | // tag_authorized_List[j]=tag_authorized_List[j+1];//电量随之更新 |
| | |
| | | uwb_rx_flag=1; |
| | | //LOG_INFO(TRACE_MODULE_APP,"打开uwb_rx\r\n"); |
| | | } |
| | | //uint8_t temp_tag_num; |
| | | void UWBOneSecondTask(void) |
| | | { |
| | | TagListUpdate();//更新标签数 |
| | |
| | | #define AREA_8 0xa8 |
| | | uint8_t change_by_distance(uint8_t position,uint16_t distance) |
| | | { |
| | | if(distance<1000){ |
| | | if(distance<g_com_map[ALARM_DISTANCE1]){ |
| | | position=position; |
| | | }else if (distance>1000&&distance<2000){ |
| | | }else if (distance>g_com_map[ALARM_DISTANCE1]&&distance<g_com_map[ALARM_DISTANCE2]){ |
| | | position=position+16; |
| | | }else if (distance>2000&&distance<3000){ |
| | | }else if (distance>g_com_map[ALARM_DISTANCE2]&&distance<g_com_map[ALARM_DISTANCE3]){ |
| | | position=position+16; |
| | | } |
| | | return position; |
| | |
| | | memcpy(&usart0_send[4],&dev_id,2); //anchor_id |
| | | for(uint8_t i=0;i<taglist_num;i++) |
| | | { |
| | | memcpy(&usart0_send[6+i*16],tagid_list[i],2); |
| | | usart0_send[8+i*20] = tag_seq[i];//包序 |
| | | memcpy(&usart0_send[6+i*16],&tagid_list[i],2); |
| | | usart0_send[8+i*16] = tag_seq[i];//包序 |
| | | memcpy(&usart0_send[9+i*16],&tagdist_list[i],2); //distance |
| | | memcpy(&usart0_send[11+i*16],&angle_azimuth[i],2);//angle_azithum |
| | | memcpy(&usart0_send[13+i*16],&angle_elevation[i],2);//angle_elevation |
| | | memcpy(&usart0_send[15+i*16],&tag_rssi[i],1); //信号强度 |
| | | memcpy(&usart0_send[16+i*16],&rssi_quality[i],1); //信号质量预留 |
| | | usart0_send[17+i*20]=anchordata_bat[i];//标签电量 |
| | | usart0_send[17+i*16]=anchordata_bat[i];//标签电量 |
| | | memcpy(&usart0_send[18+i*16],&state_button[i],2); //设备状态 |
| | | memcpy(&usart0_send[20+i*16],&pressure[i],2); //气压 |
| | | } |
| | |
| | | static struct KF_MAT_VALUE_CACHE_T kf_mat_value_cache[KF_SUPPORT_NUM]; |
| | | void Anchor_uwb_aoa_square_init(void) |
| | | { |
| | | uwb_open(); |
| | | |
| | | // Set calibration parameters |
| | | uwb_calibration_params_set(config.phy_cfg.ch_num); |
| | | |