WXK
2 天以前 7d13fbde75b58ff4c9deaef95ca0c03a1083f8e8
keil/uwb_tag.c
@@ -568,6 +568,7 @@
//                        }
                    }
}
extern int16_t fVoltage_mv;
uint8_t readgcom_flag1;
uint32_t current_count11,current_count22,current_count33,current_count44,current_count55;
uint16_t adc_caiji;
@@ -619,7 +620,7 @@
    recbase_num=0;
    phy_timer_open(1, IRQ_PRIORITY_HIGH);
    mac_register_process_handler(tx_int_callback, rx_int_callback);
    tx_near_msg[BATTARY_IDX] = bat_percent;
    tx_near_msg[BATTARY_IDX] = (fVoltage_mv-1000)/10;;
//    tx_near_msg[BUTTON_IDX] = 0/*userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5*/;
    tx_near_msg[SEQUENCE_IDX] = frame_seq_nb;
//    tx_near_msg[SEQUENCEH_IDX] = (frame_seq_nb++)>>8;
@@ -643,7 +644,7 @@
    poll_tx_ts_i64 = ranging_tx_time_correct(poll_tx_en_start_u32 + phy_shr_duration());//修正时间戳
    temp_tag_count1=phy_timer_count_get();
    adc_caiji++;
    if(adc_caiji>5&&adc_one==0)
    if(adc_caiji>30&&adc_one==0)
    {
    adc_one=1;  
    adc_caiji=0;  
@@ -666,7 +667,7 @@
    resp_rx_en_start_u32 =  temp_tag_count2+ US_TO_PHY_TIMER_COUNT(600);//设置发送多少s后接收按target独立时间起点算+ US_TO_PHY_TIMER_COUNT(POLL_TX_TO_RESP_RX_DLY_US为发送后要多久开启接收时间
    temp_resp=resp_rx_en_start_u32;
    tempflag=uwb_rx(1,resp_rx_en_start_u32, RESP_RX_TIMEOUT_US);
//    tempflag=uwb_rx(0,0, 3000);
//    tempflag=uwb_rx(0,0, 15000);
    receive_flag =0;
   start_receive_count=phy_timer_count_get();
   poll_timeout=US_TO_PHY_TIMER_COUNT(600);//多一个多0.4ms默认0.4ms计算为0.125*4*100000,默认开启1mss
@@ -795,7 +796,7 @@
        motor_flag = 0;
    }
    tx_near_msg[BATTARY_IDX] = bat_percent;
    tx_near_msg[BATTARY_IDX] = (fVoltage_mv-1000)/10;
    tx_near_msg[BUTTON_IDX] = userkey_state|stationary_flag<<1|gotosleep_flag<<2|motor_flag<<5;
    tx_near_msg[SEQUENCE_IDX] = frame_seq_nb;
    tx_near_msg[SEQUENCEH_IDX] = (frame_seq_nb++)>>8;
@@ -821,13 +822,13 @@
    poll_tx_ts_i64 = ranging_tx_time_correct(poll_tx_en_start_u32 + phy_shr_duration());//修正时间戳
    temp_tag_count1=phy_timer_count_get();
    adc_caiji++;
    if(adc_caiji>5&&adc_one==0)
    if(adc_caiji>30&&adc_one==0)
    {
    adc_one=1;  
    adc_caiji=0;  
    MinuteTask();
    }
    else if(adc_one==1&&adc_caiji>3600)
    else if(adc_one==1&&adc_caiji>1)
    {
    adc_caiji=0;  
    MinuteTask();