| | |
| | | |
| | | extern int simple_main(void); |
| | | extern int temp_main(void); |
| | | void Calibration_Time(void); |
| | | void TagListUpdate(void); |
| | | extern void IO_LED_control_change(uint8_t data); |
| | | extern void IO_control_init(void); |
| | |
| | | uint32_t temp_count2=0; |
| | | uint32_t temp_count3=0; |
| | | uint32_t temp_internal=0; |
| | | int16_t elevation = 0; |
| | | int16_t azimuth = 0; |
| | | uint8_t fom = 0; |
| | | int32_t distance; |
| | | uint8_t taglist_num; |
| | | float *sts_rssi=NULL; |
| | | extern uint8_t recev_error_num; |
| | | |
| | | extern Operation_step UWB_work_state; |
| | |
| | | /* RX done process handler. */ |
| | | int8_t rssi; |
| | | static void rx_int_callback(struct MAC_HW_REPORT_T *rx_report) |
| | | { |
| | | { uint8_t valid_sts=0; |
| | | // Power off radio |
| | | power_off_radio(); |
| | | |
| | |
| | | poll_rx_num++; |
| | | rssi = rx_report->rssi; |
| | | receive_flag=1; |
| | | |
| | | valid_sts= sts_valid_check(); |
| | | if (valid_sts) |
| | | { |
| | | aoa_calculate(&elevation, &azimuth); |
| | | aoa_fom_get(NULL, &fom); |
| | | // float pdoa[3]; |
| | | // pdoa[0] = pdoa_select_get(0, 3); |
| | | // pdoa[1] = pdoa_select_get(1, 3); |
| | | // pdoa[2] = pdoa_select_get(2, 3); |
| | | // LOG_INFO(TRACE_MODULE_APP, "PDOA: %f %f %f\r\n", pdoa[0], pdoa[1], pdoa[2]); |
| | | |
| | | sts_rssi = sts_rssi_output_get(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | uint16_t uwb_searchcount; |
| | | uint8_t flag_recsuccess; |
| | | uint8_t flag_temp2,flag_temp1; |
| | | uint8_t valid_sts = 0; |
| | | int16_t elevation = 0; |
| | | int16_t azimuth = 0; |
| | | uint8_t fom = 0; |
| | | uint32_t start_receive_count_calibration; |
| | | uint32_t current_count_calibration; |
| | | uint8_t secondtask_search_count,secondtask_search_flag; |
| | | extern uint8_t g_start_send_flag,search_open_flag = 1,link_success_flag,flag_secondtask; |
| | | void Calibration_Time(void) |
| | | { |
| | | current_count_calibration=phy_timer_count_get(); |
| | | if((current_count_calibration-start_receive_count_calibration>=MS_TO_PHY_TIMER_COUNT(500)||current_count_calibration+(UINT32_MAX-start_receive_count_calibration)>=MS_TO_PHY_TIMER_COUNT(500)) |
| | | &&!((end_receive_count-current_count_calibration<=MS_TO_PHY_TIMER_COUNT(200))||(end_receive_count+(UINT32_MAX-current_count_calibration)<=MS_TO_PHY_TIMER_COUNT(200)))) |
| | | { |
| | | start_receive_count_calibration=current_count_calibration;//更新开始时间 |
| | | // MotorPoll(); |
| | | |
| | | if(secondtask_search_count++%2==0) |
| | | { |
| | | secondtask_search_flag = 1; |
| | | }else{ |
| | | secondtask_search_flag = 0; |
| | | } |
| | | if(secondtask_search_flag)//更新S时间TICK |
| | | { |
| | | HIDO_TimerTick(); |
| | | TagListUpdate(); |
| | | // GPS_Poll(); |
| | | // if(nomove_count<=g_com_map[NOMOVESLEEP_TIME])//防止溢出 |
| | | // nomove_count++; |
| | | // else{ |
| | | // nomove_count=g_com_map[NOMOVESLEEP_TIME]+1; |
| | | // } |
| | | } |
| | | // update_led_power_state();//更新等状态防止震动卡死在搜索 |
| | | } |
| | | } |
| | | |
| | | int UwbRange(void) |
| | | { |
| | | uint8_t i; |
| | |
| | | current_count=phy_timer_count_get(); |
| | | while(mac_is_busy()) |
| | | { |
| | | Calibration_Time(); |
| | | IdleTask(); |
| | | current_count=phy_timer_count_get(); |
| | | if(current_count>end_receive_count&¤t_count<end_receive_count+HALF_SECOND_TIME) |
| | |
| | | } |
| | | recev_error_num=0; |
| | | range_timeout_us=5000;//恢复为5000进入range后 |
| | | LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d 信号强度:%d.\r\n",g_com_map[BIND_DEV_ID],distance,rssi); |
| | | LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d 信号强度ANT0:%d,信号强度ANT2:%d\r\n",g_com_map[BIND_DEV_ID],distance,sts_rssi[0],sts_rssi[2]); |
| | | gpio_pin_clr(SCL_PIN); |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | gpio_pin_clr(SCL_PIN);//测试 |
| | | LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d 信号强度:%d.\r\n",g_com_map[BIND_DEV_ID],distance,rssi); |
| | | LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d 信号强度ANT0:%d,信号强度ANT2:%d\r\n",g_com_map[BIND_DEV_ID],distance,sts_rssi[0],sts_rssi[2]); |
| | | return 1;//返回发送成功标志 |
| | | } |
| | | |