zhangbo
2025-03-07 b8fac32aed712a3e0e87cea99b9c6d5ef5e12d2b
现在单个测距完成,然后3s测一次距功能实现
已修改10个文件
21798 ■■■■ 文件已修改
keil/Listings/uwb_simple_example.map 6362 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.build_log.htm 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.hex 10421 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.htm 3972 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example_MK8000 Release.dep 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/drivers/PCA9555.c 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/main/main.c 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/src/Radio/lora_1268.c 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/uwb_app.c 620 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/uwb_simple_example.uvoptx 273 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Listings/uwb_simple_example.map
ÎļþÌ«´ó
keil/Objects/uwb_simple_example.build_log.htm
@@ -21,20 +21,14 @@
Dialog DLL:      TARMCM1.DLL V1.14.2.0
 
<h2>Project:</h2>
D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-进口lora\keil\uwb_simple_example.uvprojx
D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-jinkoulora\keil\uwb_simple_example.uvprojx
Project File Date:  03/03/2025
<h2>Output:</h2>
*** Using Compiler 'V6.14', folder: 'D:\keil\ARM\ARMCLANG\Bin'
Build Project 'uwb_simple_example' - Target 'MK8000 Release'
compiling main.c...
linking...
D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-进口lora\keil\include\devices\MK800X\Source\ARM\MK800X_ac6_copy.sct(25): warning: L6314W: No section matches pattern *(.XIP_SECTION).
Program Size: Code=79472 RO-data=8956 RW-data=1748 ZI-data=27064
Finished: 0 information, 1 warning and 0 error messages.
FromELF: creating hex file...
After Build - User command #1: fromelf.exe --bincombined -o "Output\uwb_simple_example.bin" "D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-进口lora\keil\Objects\uwb_simple_example.axf"
".\Objects\uwb_simple_example.axf" - 0 Error(s), 1 Warning(s).
After Build - User command #1: fromelf.exe --bincombined -o "Output\uwb_simple_example.bin" "D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-jinkoulora\keil\Objects\uwb_simple_example.axf"
".\Objects\uwb_simple_example.axf" - 0 Error(s), 0 Warning(s).
<h2>Software Packages used:</h2>
@@ -48,7 +42,7 @@
  D:\keil\pack\MKSEMI\MK800X_DFP\1.0.3\Device\Include
<h2>Collection of Component Files used:</h2>
Build Time Elapsed:  00:00:01
Build Time Elapsed:  00:00:00
</pre>
</body>
</html>
keil/Objects/uwb_simple_example.hex
ÎļþÌ«´ó
keil/Objects/uwb_simple_example.htm
ÎļþÌ«´ó
keil/Objects/uwb_simple_example_MK8000 Release.dep
@@ -529,7 +529,7 @@
I (include\drivers\mk_dma.h)(0x672473BD)
I (D:\keil\ARM\ARMCLANG\include\stdarg.h)(0x5DDFFD72)
F (.\include\drivers\mk_timer.h)(0x67206CDD)()
F (.\include\drivers\PCA9555.c)(0x67C658BA)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/drivers -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/pca9555.o -MD)
F (.\include\drivers\PCA9555.c)(0x67C6B09C)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/drivers -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/pca9555.o -MD)
I (include\drivers\PCA9555.h)(0x67BFDB96)
I (include\board\board.h)(0x67AC74B2)
I (include\drivers\mk_common.h)(0x67206CDC)
@@ -748,7 +748,7 @@
I (include\drivers\mk_gpio.h)(0x67206CDC)
I (include\drivers\Usart.h)(0x67B4382E)
I (..\keil\lora_3029.h)(0x67C55DCF)
F (.\include\main\main.c)(0x67C6A882)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/main.o -MD)
F (.\include\main\main.c)(0x67CAAF6E)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/main.o -MD)
I (include\drivers\mk_trace.h)(0x67206CDC)
I (include\drivers\mk_common.h)(0x67206CDC)
I (D:\keil\ARM\ARMCLANG\include\stddef.h)(0x5DDFFD72)
@@ -865,7 +865,7 @@
I (D:\keil\ARM\ARMCLANG\include\stdarg.h)(0x5DDFFD72)
I (include\drivers\mk_gpio.h)(0x67206CDC)
I (include\drivers\mk_io.h)(0x67206CDC)
F (.\uwb_app.c)(0x67C55E0E)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/uwb_app.o -MD)
F (.\uwb_app.c)(0x67CAB16B)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/uwb_app.o -MD)
I (include\drivers\mk_trace.h)(0x67206CDC)
I (include\drivers\mk_common.h)(0x67206CDC)
I (D:\keil\ARM\ARMCLANG\include\stddef.h)(0x5DDFFD72)
@@ -898,6 +898,7 @@
I (include\drivers\mk_gpio.h)(0x67206CDC)
I (include\drivers\mk_io.h)(0x67206CDC)
I (..\keil\lora_1268.h)(0x67C561EC)
I (include\drivers\PCA9555.h)(0x67BFDB96)
F (.\lora_3029.c)(0x67C563BA)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/lora_3029.o -MD)
F (.\include\components\wsf\sources\port\baremetal\wsf_assert.c)(0x67206CDE)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/components/wsf/include/platform -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/wsf_assert.o -MD)
I (include\components\wsf\include\wsf_assert.h)(0x67206CDE)
@@ -1429,7 +1430,7 @@
I (include\devices\MK800X\Include\system_MK800X.h)(0x67206CDC)
I (..\user_config.h)(0x67AC72E5)
I (include\drivers\mk_dma.h)(0x672473BD)
F (.\include\src\Radio\lora_1268.c)(0x67C6A25E)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/lora_1268.o -MD)
F (.\include\src\Radio\lora_1268.c)(0x67CA9C01)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/lora_1268.o -MD)
I (D:\keil\ARM\ARMCLANG\include\math.h)(0x5DDFFD6C)
I (D:\keil\ARM\ARMCLANG\include\string.h)(0x5DDFFD6C)
I (include\src\Radio\sx126x.h)(0x675256A6)
keil/include/drivers/PCA9555.c
@@ -568,7 +568,7 @@
//    PCA9555_Set_One_Value_Config(SOS_ENBALE,1);//设置SOS按钮输入
  LORA_NRST_UP;    
    LORA_LED_ON;
    LORA_LED_OFF;
    GREEN_LED_OFF;
    UWB_LED_OFF;
    RED_LED_OFF;
@@ -600,26 +600,15 @@
uint8_t Sos_state;
void SOS_irq_callback()
{
    Sos_state=!Sos_state;
    if(Sos_state)
    {
        UWB_LED_ON;
    RED_LED_ON;
    }
    else
    {
        UWB_LED_OFF;
    RED_LED_OFF;
    }
}
//void WAKE_UP_irq_callback()
@@ -632,11 +621,11 @@
      Sos_state=!Sos_state;
        if(Sos_state)
    {
    LORA_LED_ON;
        GREEN_LED_ON;
    }
    else
    {
    LORA_LED_OFF;
        GREEN_LED_OFF;
    }
      
}
keil/include/main/main.c
@@ -297,7 +297,7 @@
        }
    }
    HIDO_TimerTick();
//    HIDO_TimerTick();
    nomove_count++;
}
uint8_t flag_sleeptimer,flag_secondtask,secondtask_count;
@@ -306,12 +306,13 @@
static void sleep_timer_callback(void *dev, uint32_t time)
{
    g_start_send_flag=1;
      HIDO_TimerTick();
    //        #ifdef DEBUG_BOXING
////        gpio_pin_clr(IO_PIN_5);//测试
    //    gpio_pin_set(IO_PIN_5);//测试
      // lora_wg_up=1;
       
       lora_tx_flag++;
       lora_tx_flag=1;
//       lora_qiehuan++;
//    IO_control_init();
//    UWBPoll();
@@ -383,6 +384,7 @@
//    g_com_map[GROUP_ID]=1;
    dev_id=g_com_map[DEV_ID];//这里不太对
    group_id=g_com_map[GROUP_ID];//组ID
      g_com_map[LORA_POWER]=22;
    tag_frequency = 1000/g_com_map[COM_INTERVAL];//测距频率这个存的是测距时间
    memcpy(&disoffset,&g_com_map[DIST_OFFSET],2);
//    g_com_map[ALARM_DISTANCE1] = 40;
@@ -554,31 +556,7 @@
/********************************************************************************************************/
/********************************************************************************************************/
/********************************************************************************************************/
//static uint16_t delaytime = 771;
//extern uint16_t wg_report_freq,wg_report_id;
//extern uint32_t wg_lost_count;
//extern uint8_t shengji_flag;
//extern uint8_t lora_jianting_flag,report_ancnum;
//uint8_t imu_enable,motor_enable;
//uint32_t time_flag_lorarx=0;
//uint32_t lora_huanxing_count=0;
//uint16_t Lora_wangguanid=0;
//wg_state_enum wg_state = WG_Lost;
//uint16_t wangguan_up_id;
//uint8_t LoraUp_flag;
//uint16_t rec_wenjian_daxiao;
//uint16_t recnum[3];
//uint16_t recv_flag=0;
//uint16_t tx_flag=0;
//uint16_t CRC16=0;
//uint16_t DEST_ID=0;
//uint16_t rec_value,rec_delaytime,rx_count,datalen_offset;
//uint16_t Loratx_flag=0;
//uint16_t Lorarx_flag=0;
//uint16_t Lorarx_time_out_flag=0;
//uint8_t tx_buf[5]={0,1,0,1,1};
//uint32_t sleep_time_count=0;
//uint32_t uwb_ceju_count=0;
wg_state_enum wg_state = WG_Lost;
/********************************************************************************************************/
static void Lora_irq_handler(enum IO_PIN_T pin)
@@ -610,6 +588,7 @@
uint8_t TXBuffer[8]={0,1,2,3,4,5,6,7};
uint8_t test_buf[10]={0,1,1,1,1,1,1,1,1,1};
int main(void)
{
    board_clock_run();
        //  boot_deinit();
@@ -626,21 +605,26 @@
    //board_led_init();
    spi_init();
    Board_LORA_NVIC_Init(Lora_irq_handler);
      pca_input_detection_init(pca_handler);
        IIC2_Init();
    Accelerometer_Init();
        PCA9555_init();
        Lora_1268_Init();
    SwitchLoraSettings(478,7,22);
//    SwitchLoraSettings(473,7,0);
        Program_Init();
    sleep_timer_open(true, SLEEP_TIMER_MODE_RELOAD, sleep_timer_callback);
        sleep_timer_start(__MS_TO_32K_CNT(1000));//测试
    
    Uwbinit();
        OpenUWB();
    while (1)
    { 
        Lora_Tx_Poll();
//            uwb_app_poll();
      IdleTask();
    }
}
keil/include/src/Radio/lora_1268.c
@@ -165,6 +165,7 @@
uint16_t heatbeat_count = HEATBEAT_UPDATE_TIME-1 ;
uint16_t flag_getwgresp = 0;
int16_t intheight;            //气压
uint16_t FACHU_FLAG=0;
extern uint32_t dangqian_frqe;
uint16_t recnum[3];
extern uint32_t freq_list[4];
@@ -175,6 +176,8 @@
uint8_t BT_NUM=0;
extern uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM];
extern uint8_t bat_percent;
extern int32_t tagdist_list[TAG_NUM_IN_SYS];
extern uint16_t tagid_list[TAG_NUM_IN_SYS];
void LoraReportPoll(void)
{
    // delay_ms(100);
@@ -191,14 +194,9 @@
    LoraReportFreqPoll();
    flag_getwgresp = 0;
   // wg_report_freq = REPORT_MANGE_CHANNEL_FRQ;
     //Lora_init();
        uint32_t para;
        para=freq_list[2] * 100000;
// wg_report_freq = REPORT_MANGE_CHANNEL_FRQ;
//        rf_set_sf(REPORT_CHANNEL_SF);
        SwitchLoraSettings(para,REPORT_CHANNEL_SF,0);
        SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]);
      //rf_set_default_para(wg_report_freq,REPORT_CHANNEL_SF);
   // SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,g_com_map[LORA_POWER]);
//      dangqian_frqe=rf_read_freq();
@@ -261,8 +259,12 @@
//        memcpy(&report_ancdist,test_temp2,10); 
    lora_sendbuffer[ANCNUM_IDX] = report_ancnum;
    memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2);
    memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2);
//    memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2);
//      memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2);
        memcpy(&lora_sendbuffer[ANCID_IDX],tagid_list,report_ancnum*2);
        memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],tagdist_list,report_ancnum*2);
//        tagdist_list[taglist_pos]tagid_list
        uint8_t LORA_RETRANSNUSSION_BT=0;
        BT_NUM=DMA_RXBuf_BT[0];
        if(0<BT_NUM&&BT_NUM<11)
@@ -290,7 +292,7 @@
        Radio.Send(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+2);
        }
    FACHU_FLAG++;
//    LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0);
        memset(DMA_RXBuf_BT, 0,200);
        memset(&lora_sendbuffer[ANCID_IDX],0,200);
@@ -387,6 +389,7 @@
        if(lora_send_count++%10==0||lora_jianting_flag)
        {
            lora_tx_flag=0;
//                      Anchor_RecNearPoll();
#ifdef GROUPID_SWITCH
            if(rec_secdelay>0)
            {
@@ -505,6 +508,7 @@
uint16_t BufferSize = BUFFER_SIZE;
uint16_t CRC16=0;
uint16_t DEST_ID=0;
uint16_t JIESHOU_FLAG=0;
uint8_t shengji_flag;
int8_t RssiValue = 0;
int8_t SnrValue = 0;
@@ -524,8 +528,8 @@
void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr )
{  
    
    uint16_t checksum1;
//        LORA_LED_ON;
                uint16_t checksum1;
        BufferSize = size;
        memcpy( RX_Buffer, payload, BufferSize );
        RssiValue = rssi;
@@ -536,7 +540,7 @@
                 if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_WGRESPTAG)
                        {
                            checksum1=Checksum_u16(RX_Buffer,BufferSize-2);
                            JIESHOU_FLAG++;
              memcpy(&DEST_ID,&RX_Buffer[DEST_ID_IDX],2);
                            memcpy(&CRC16,&RX_Buffer[BufferSize-2],2);
                            if(!memcmp(&checksum1,&RX_Buffer[BufferSize-2],2))
@@ -554,23 +558,24 @@
                                        switch(RX_Buffer[PWTAG_RW_FLAG_IDX])
                                        {
                                                case WGRSP_RWTAG_NONE:
                        wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400;
                        memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2);
                        if(report_ancnum<2)
                        {
                            datalen_offset = report_ancnum*85;
                        }else{
                            datalen_offset = (report_ancnum-1)*46+85;
                        }
                        rec_secdelay = RX_Buffer[PWTAG_SECDELAY_IDX];
                        if(BufferSize!=13||rec_secdelay>20)
                        {
                         rec_secdelay = 0;
                        }
                        sleep_time_count = rec_delaytime - delaytime-datalen_offset;
                        while(sleep_time_count>=1000)
                            sleep_time_count-=1000;
                                                sleep_timer_start(sleep_time_count);
//                                                    LORA_LED_OFF;
//                        wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400;
//                        memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2);
//                        if(report_ancnum<2)
//                        {
//                            datalen_offset = report_ancnum*85;
//                        }else{
//                            datalen_offset = (report_ancnum-1)*46+85;
//                        }
//                        rec_secdelay = RX_Buffer[PWTAG_SECDELAY_IDX];
//                        if(BufferSize!=13||rec_secdelay>20)
//                        {
//                         rec_secdelay = 0;
//                        }
//                        sleep_time_count = rec_delaytime - delaytime-datalen_offset;
//                        while(sleep_time_count>=1000)
//                            sleep_time_count-=1000;
//                                                sleep_timer_start(sleep_time_count);
                        break;
                                                case WGRSP_RWTAG_READ:
@@ -629,6 +634,7 @@
            Radio.Rx(0);
        }
    }
}
void OnTxTimeout( void )
keil/uwb_app.c
@@ -9,10 +9,18 @@
#include "global_param.h"
#include "board.h"
#include "lora_1268.h"
#include "PCA9555.h"
#define TAG_KEEPTIMES           30
#define REPORT_TAG_KEEPTIMES     1
/************************************信号量 *******************************************************/
typedef enum {
    UWB_STATE_IDLE,
    UWB_TX_STATE_BUSY,
    UWB_RX_STATE_BUSY
} UWB_State_t;
// å…¨å±€çŠ¶æ€å˜é‡
volatile UWB_State_t UWB_STATE = UWB_STATE_IDLE;
/************************************信号量 *******************************************************/
#define GROUP_NUM   3
uint16_t group_min_dist[GROUP_NUM+1];
@@ -46,7 +54,8 @@
//resp函数
void PushAnchorDataArray(uint16_t ancid,int16_t dist,uint8_t battary);//找到自己的id信息对应位置更新自己的交互信息
static void resp_msg_set_ts(uint8_t *ts_field, int64_t ts);//用来对应位置放入时间戳
static uint16_t tagid_list[TAG_NUM_IN_SYS];
//static uint16_t tagid_list[TAG_NUM_IN_SYS];
uint16_t tagid_list[TAG_NUM_IN_SYS];
uint16_t CmpTagInList(uint16_t tagid);
uint8_t Anchor_RecNearPoll(uint8_t ancrec_nearbasepos);
static uint8_t send_buffer[100];
@@ -87,7 +96,7 @@
#define RANGING_PERIOD_MS (1000)
/* This is the delay from Frame RX POLL frame to send RESP Frame */
#define POLL_RX_TO_RESP_TX_DLY_US 750U //yuan750 7500Haoyong
#define POLL_RX_TO_RESP_TX_DLY_US 1800U //yuan750 7500Haoyong
#define RESP_TX_TO_FINAL_RX_DLY_US 500U
@@ -268,10 +277,12 @@
{        uint8_t valid_sts=0;
    // Power off radio
    power_off_radio();
    UWB_STATE=UWB_STATE_IDLE;
    /** UWB RX success */
    if (rx_report->err_code == UWB_RX_OK)
    {
              UWB_LED_ON;
        /* Received data does not contain FCS */
        rx_length = rx_report->pkt_len;
        memcpy(rx_buf, rx_report->pkt_data, rx_length);
@@ -283,6 +294,7 @@
        poll_rx_num++;
        rssi = rx_report->rssi;
        receive_flag=1;
//              UWB_LED_ON;
                Anchor_App();
            #ifdef STS_MODE
                valid_sts= sts_valid_check();
@@ -311,22 +323,39 @@
                    temp_count= phy_timer_count_get();
        memcpy(&rx_rpt, rx_report, sizeof(struct MAC_HW_REPORT_T));
        rx_length = 0;
            //    OpenUWB();//再次开启UWB接收
            if(UWB_STATE==UWB_STATE_IDLE)
            {
                UWB_STATE=UWB_RX_STATE_BUSY;
              OpenUWB();//再次开启UWB接收
            }
    }
    OpenUWB();//再次开启UWB接收
}
uint8_t temp_tx_flag;
/* TX done process handler. */
static void tx_int_callback(struct MAC_HW_REPORT_T *tx_report)
{
    // Power off radio
    power_off_radio();
    UWB_STATE=UWB_STATE_IDLE;
    /** UWB TX success */
    if (tx_report->err_code == UWB_TX_OK)
    {
        temp_count= phy_timer_count_get();
        temp_internal=temp_count;
        resp_tx_num++;
                if(temp_tx_flag==1)
                {
                temp_tx_flag=0;
//                UWB_LED_OFF;
                UWB_STATE=UWB_RX_STATE_BUSY;
              OpenUWB();//再次开启UWB接收
                }
              //gpio_pin_clr(IO_PIN_5);
        //LOG_INFO(TRACE_MODULE_APP, "poll_rx_num is %d,resp_tx_num is %d\r\n",poll_rx_num,resp_tx_num);
    }
@@ -335,7 +364,8 @@
static uint16_t anchordata_id[TAG_NUM_IN_SYS],anchordata_dist[TAG_NUM_IN_SYS];
static uint8_t anchordata_bat[TAG_NUM_IN_SYS];
uint8_t anchordata_num = 0;
static int32_t tagdist_list[TAG_NUM_IN_SYS];
//static int32_t tagdist_list[TAG_NUM_IN_SYS];
int32_t tagdist_list[TAG_NUM_IN_SYS];
uint16_t random_time;
//anchor
int32_t hist_dist;
@@ -433,45 +463,92 @@
uint32_t temp_count7;
uint32_t timeceshi1;
uint32_t timeceshi2;
uint8_t position;
//uint8_t Anchor_RecNearPoll(uint8_t ancrec_nearbasepos)//根据自己是否为新基站定制消息去发送,根据是否抢占判断
//{
//    temp_count2=poll_rx_en_start_u32;
//    memcpy(&send_buffer[GROUP_ID_IDX],&group_id,1);//组id
//    memcpy(&send_buffer[ANCHOR_ID_IDX],&dev_id,2);//自身id
//    memcpy(&send_buffer[TAG_ID_IDX],&tag_id_recv,2);//接受者id
//    send_buffer[MESSAGE_TYPE_IDX]=MBX_RESPONSE;
// if(rec_nearbase_num == ancrec_nearbasepos)//抢占模式自己为新基站
//    {
//        random_time = (phy_timer_count_get()%100);//多基站抢占一个位置时避免一个也收不到的情况就每一个随机错开几十uS
//        //resp_tx_time = (poll_rx_ts+((random_time+rec_nearbase_num*20 + POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
//        // (resp_tx_en_start_u32) is the moment when TX enable
//        resp_tx_en_start_u32 = poll_rx_en_start_u32+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+rec_nearbase_num*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
//
//                } else {
//        //resp_tx_time = (poll_rx_ts + ((rec_nearbase_num*20+POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
//       resp_tx_en_start_u32 = poll_rx_en_start_u32+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+rec_nearbase_num*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
//                                //这里应该有问题问一下钟工
//                }//此处设置绝对时间将poll u32改为phy_timer_count_get()
//    temp_count7=resp_tx_en_start_u32;
//    resp_tx_ts_i64 = ranging_tx_time_correct(resp_tx_en_start_u32 + phy_shr_duration());//修正时间戳
//    /* Write all timestamps in the final message. See NOTE 8 below. */
//    resp_msg_set_ts(&send_buffer[RESP_MSG_POLL_RX_TS_IDX], poll_rx_ts_i64);
//    resp_msg_set_ts(&send_buffer[RESP_MSG_RESP_TX_TS_IDX], resp_tx_ts_i64);//此处时间戳int64直接转换为uint64不知道会不会有错误
//    memcpy(&send_buffer[RESP_MSG_ANC_DISTOFFSET],&disoffset,2);//差个修正offset,修正有符号但是这个com表为无符号的,传过去直接赋给Int16_t相当于还原了
//    temp_resp_i64=resp_tx_ts_i64;
////    temp_count3= phy_timer_count_get();
////                timeceshi2=phy_timer_count_get();
//        //uint32_t time_add=1000;
//        //resp_tx_en_start_u32=resp_tx_en_start_u32+time_add;
//        temp_count3= phy_timer_count_get();
//    flag1=uwb_tx(send_buffer, 40,1 ,resp_tx_en_start_u32);//立即发送测试size大小
////    temp_count1=phy_timer_count_get();
//
//    while(mac_is_busy());
//        tagofflinetime[taglist_pos] = 0;
//    gpio_pin_clr(SCL_PIN);
//}
//uint8_t temp_tx_flag;
uint8_t buf_1[40];
uint8_t Anchor_RecNearPoll(uint8_t ancrec_nearbasepos)//根据自己是否为新基站定制消息去发送,根据是否抢占判断
{
    temp_count2=poll_rx_en_start_u32;
    memcpy(&send_buffer[GROUP_ID_IDX],&group_id,1);//组id
    memcpy(&send_buffer[ANCHOR_ID_IDX],&dev_id,2);//自身id
    memcpy(&send_buffer[TAG_ID_IDX],&tag_id_recv,2);//接受者id
    send_buffer[MESSAGE_TYPE_IDX]=MBX_RESPONSE;
 if(rec_nearbase_num == ancrec_nearbasepos)//抢占模式自己为新基站
    {
        random_time = (phy_timer_count_get()%100);//多基站抢占一个位置时避免一个也收不到的情况就每一个随机错开几十uS
        //resp_tx_time = (poll_rx_ts+((random_time+rec_nearbase_num*20 + POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
        // (resp_tx_en_start_u32) is the moment when TX enable
        resp_tx_en_start_u32 = poll_rx_en_start_u32+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+rec_nearbase_num*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
                } else {
        //resp_tx_time = (poll_rx_ts + ((rec_nearbase_num*20+POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
       resp_tx_en_start_u32 = poll_rx_en_start_u32+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+rec_nearbase_num*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
                                //这里应该有问题问一下钟工
                }//此处设置绝对时间将poll u32改为phy_timer_count_get()
    temp_count7=resp_tx_en_start_u32;
//    if(rec_nearbase_num == ancrec_nearbasepos)//抢占模式自己为新基站
//    {
//        random_time = (phy_timer_count_get()%100);//多基站抢占一个位置时避免一个也收不到的情况就每一个随机错开几十uS
//        //resp_tx_time = (poll_rx_ts+((random_time+rec_nearbase_num*20 + POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
//        // (resp_tx_en_start_u32) is the moment when TX enable
//        resp_tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+rec_nearbase_num*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
//
//        } else {
//        //resp_tx_time = (poll_rx_ts + ((rec_nearbase_num*20+POLL_RX_TO_RESP_TX_DLY_UUS+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS) * UUS_TO_DWT_TIME)) >> 8;//计算Response发送时间T3。
//       resp_tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(20*rec_nearbase_num+POLL_RX_TO_RESP_TX_DLY_US+ancrec_nearbasepos*DELAY_BETWEEN_TWO_FRAME_UUS);//后面的需要根据已有基站数量进行更改,如果是抢占自己最后一个回复,要有底数
//                //这里应该有问题问一下钟工
//        }//此处设置绝对时间将poll u32改为phy_timer_count_get()
        position=ancrec_nearbasepos;
      temp_count1=phy_timer_count_get();
        resp_tx_en_start_u32 = poll_rx_en_start_u32+US_TO_PHY_TIMER_COUNT(POLL_RX_TO_RESP_TX_DLY_US)+ancrec_nearbasepos*US_TO_PHY_TIMER_COUNT(DELAY_BETWEEN_TWO_FRAME_UUS);//加入帧间隔
//    resp_tx_en_start_u32 = temp_count1+US_TO_PHY_TIMER_COUNT(POLL_RX_TO_RESP_TX_DLY_US)+ancrec_nearbasepos*US_TO_PHY_TIMER_COUNT(DELAY_BETWEEN_TWO_FRAME_UUS);//加入帧间隔
    resp_tx_ts_i64 = ranging_tx_time_correct(resp_tx_en_start_u32 + phy_shr_duration());//修正时间戳
    /* Write all timestamps in the final message. See NOTE 8 below. */
    resp_msg_set_ts(&send_buffer[RESP_MSG_POLL_RX_TS_IDX], poll_rx_ts_i64);
    resp_msg_set_ts(&send_buffer[RESP_MSG_RESP_TX_TS_IDX], resp_tx_ts_i64);//此处时间戳int64直接转换为uint64不知道会不会有错误
    memcpy(&send_buffer[RESP_MSG_ANC_DISTOFFSET],&disoffset,2);//差个修正offset,修正有符号但是这个com表为无符号的,传过去直接赋给Int16_t相当于还原了
    temp_resp_i64=resp_tx_ts_i64;
//    temp_count3= phy_timer_count_get();
//                timeceshi2=phy_timer_count_get();
        //uint32_t time_add=1000;
        //resp_tx_en_start_u32=resp_tx_en_start_u32+time_add;
        temp_count3= phy_timer_count_get();
    flag1=uwb_tx(send_buffer, 40,1 ,resp_tx_en_start_u32);//立即发送测试size大小
//    temp_count1=phy_timer_count_get();
    while(mac_is_busy());
        tagofflinetime[taglist_pos] = 0;
    gpio_pin_clr(SCL_PIN);
    temp_count3= phy_timer_count_get();
//        temp_rx=uwb_rx(buf_1,0,10);
//        CloseUWB();
    UWB_STATE==UWB_TX_STATE_BUSY;
    flag_temp2=uwb_tx(send_buffer, 40,1 ,resp_tx_en_start_u32);//立即发送测试size大小
        tagofflinetime[taglist_pos] = 0;//更新标签通信
    temp_count1=phy_timer_count_get();
        temp_tx_flag=1;
        Delay_Ms(2);
//    while(mac_is_busy());
//    gpio_pin_clr(SCL_PIN);
}
uint16_t uwb_searchcount= 2000000;
@@ -487,168 +564,192 @@
uint32_t UWB_fachu_count=0;
uint32_t UWB_qiangzhanfachu_count=0;
uint32_t UWB_1003_count,UWB_6666_count=0;
int UwbRange(void)
{
//int UwbRange(void)
//{
    uint8_t i;
    uint16_t tempid;
//    uint8_t i;
//    uint16_t tempid;
    mac_register_process_handler(tx_int_callback, rx_int_callback);
    receive_flag = 0;
        flag_recsuccess = 0;
//    mac_register_process_handler(tx_int_callback, rx_int_callback);
//    receive_flag = 0;
//        flag_recsuccess = 0;
    uwb_rxflag=uwb_rx(0, 0, range_timeout_us);//开启接收
////    uwb_rxflag=uwb_rx(0, 0, range_timeout_us);//开启接收
    uwb_rxflag_num1++;
  //  while(mac_is_busy());
  //  temp_count2=phy_timer_count_get();
        start_receive_count=phy_timer_count_get();
    poll_timeout=US_TO_PHY_TIMER_COUNT(range_timeout_us);//多一个多0.4ms默认0.4ms计算为0.125*4*100000,默认开启1mss
    end_receive_count=start_receive_count+poll_timeout;
    if(end_receive_count>=UINT32_MAX)
    {end_receive_count-=UINT32_MAX;}
    current_count=phy_timer_count_get();
            while(mac_is_busy())
        {
//            IdleTask();
            current_count=phy_timer_count_get();
            if(current_count>end_receive_count&&current_count<end_receive_count+HALF_SECOND_TIME)//超时时间为4.992秒
            {
                    break;
            }
        }
    if(receive_flag==1)//成功接收
    {
        time_count_sdsj=phy_timer_count_get();
//             gpio_pin_set(IO_PIN_5);
//        gpio_pin_clr(IO_PIN_5);
        #ifdef DEBUG_BOXING
//        gpio_pin_set(IO_PIN_5);//测试
//        gpio_pin_clr(IO_PIN_5);//测试
        #endif
//            timeceshi1=phy_timer_count_get();
//            temp_count7=poll_rx_en_start_u32;
        receive_flag=0;
        if(group_id==rx_buf[GROUP_ID_IDX]&&rx_buf[MESSAGE_TYPE_IDX] == MBX_POLL)/*&&!memcmp(&rx_buf[TAG_ID_IDX],&g_com_map[BIND_DEV_ID],2)*///判断是否是和自己是同一组通讯的且为poll包
        {
//                        UWB_shoudao_count++;
                        flag_recsuccess = 1;
//                      temp_count2=phy_timer_count_get();
            frame_seq_nb2 = rx_buf[SEQUENCE_IDX];//获取包序
            battary = rx_buf[BATTARY_IDX];
            rec_nearbase_num=rx_buf[FZ_NEARBASENUM_INDEX];  //标签传过来的他与基站交互的基站id数目
                      //rec_nearbase_num=25;
            memcpy(&tag_id_recv,&rx_buf[TAG_ID_IDX],2);
            memcpy(rec_ancidlist,&rx_buf[FZ_NEARBASEID_INDEX],2*rec_nearbase_num);
            memcpy(rec_ancdistlist,&rx_buf[FZ_NEARBASEID_INDEX+2*rec_nearbase_num],2*rec_nearbase_num);
            // memcpy(&rec_antdelay,&rx_buf[FZ_NEARBASEID_INDEX+rec_nearbase_num*4],2);
//            timeceshi1=phy_timer_count_get();
//            temp_count7=poll_rx_en_start_u32;
                      taglist_pos=CmpTagInList(tag_id_recv);
            for(i=0; i<rec_nearbase_num; i++)
            {
                if(rec_ancidlist[i] == dev_id)
                {
                    rec_ancdistlist[i]+=(int16_t)g_com_map[DIST_OFFSET];
                    PushAnchorDataArray(tag_id_recv,rec_ancdistlist[i],battary);
                                      UWB_fachu_count++;
//    uwb_rxflag_num1++;
//  //  while(mac_is_busy());
//  //  temp_count2=phy_timer_count_get();
//        start_receive_count=phy_timer_count_get();
//    poll_timeout=US_TO_PHY_TIMER_COUNT(range_timeout_us);//多一个多0.4ms默认0.4ms计算为0.125*4*100000,默认开启1mss
//    end_receive_count=start_receive_count+poll_timeout;
//    if(end_receive_count>=UINT32_MAX)
//    {end_receive_count-=UINT32_MAX;}
//    current_count=phy_timer_count_get();
//            while(mac_is_busy())
//        {
////            IdleTask();
//            current_count=phy_timer_count_get();
//            if(current_count>end_receive_count&&current_count<end_receive_count+HALF_SECOND_TIME)//超时时间为4.992秒
//            {
//                    break;
//            }
//        }
//
//    if(receive_flag==1)//成功接收
//    {
//        time_count_sdsj=phy_timer_count_get();
////             gpio_pin_set(IO_PIN_5);
//
////        gpio_pin_clr(IO_PIN_5);
//        #ifdef DEBUG_BOXING
////        gpio_pin_set(IO_PIN_5);//测试
////        gpio_pin_clr(IO_PIN_5);//测试
//        #endif
////            timeceshi1=phy_timer_count_get();
////            temp_count7=poll_rx_en_start_u32;
//        receive_flag=0;
//        if(group_id==rx_buf[GROUP_ID_IDX]&&rx_buf[MESSAGE_TYPE_IDX] == MBX_POLL)/*&&!memcmp(&rx_buf[TAG_ID_IDX],&g_com_map[BIND_DEV_ID],2)*///判断是否是和自己是同一组通讯的且为poll包
//        {
////                        UWB_shoudao_count++;
//                        flag_recsuccess = 1;
////                      temp_count2=phy_timer_count_get();
//            frame_seq_nb2 = rx_buf[SEQUENCE_IDX];//获取包序
//            battary = rx_buf[BATTARY_IDX];
//            rec_nearbase_num=rx_buf[FZ_NEARBASENUM_INDEX];  //标签传过来的他与基站交互的基站id数目
//
//                      //rec_nearbase_num=25;
//
//            memcpy(&tag_id_recv,&rx_buf[TAG_ID_IDX],2);
//            memcpy(rec_ancidlist,&rx_buf[FZ_NEARBASEID_INDEX],2*rec_nearbase_num);
//            memcpy(rec_ancdistlist,&rx_buf[FZ_NEARBASEID_INDEX+2*rec_nearbase_num],2*rec_nearbase_num);
//            // memcpy(&rec_antdelay,&rx_buf[FZ_NEARBASEID_INDEX+rec_nearbase_num*4],2);
////            timeceshi1=phy_timer_count_get();
////            temp_count7=poll_rx_en_start_u32;
//                      taglist_pos=CmpTagInList(tag_id_recv);
//            for(i=0; i<rec_nearbase_num; i++)
//            {
//
//                if(rec_ancidlist[i] == dev_id)
//                {
//                    rec_ancdistlist[i]+=(int16_t)g_com_map[DIST_OFFSET];
//                    PushAnchorDataArray(tag_id_recv,rec_ancdistlist[i],battary);
//                                      UWB_fachu_count++;
////        #ifdef DEBUG_BOXING
//////        gpio_pin_clr(IO_PIN_5);//测试
////        gpio_pin_set(IO_PIN_5);//测试
////        #endif
//                }
//            }
//            for(i=0; i<rec_nearbase_num; i++)
//            {
//                                memcpy(&tempid,&rx_buf[FZ_NEARBASEID_INDEX+i*2],2);
//                    if(tempid==dev_id)
//                    {
//                        Anchor_RecNearPoll(i);
//                                      tagdist_list[taglist_pos]=rec_ancdistlist[i];
//                        if(group_min_dist[group_id]>rec_ancdistlist[i])
//                        {
//                            group_min_dist[group_id] = rec_ancdistlist[i];
//                        }
//                        if(taglist_pos==taglist_num)// taglist_pos==taglist_num è¯´æ˜Žè¿™ä¸ªåŸºç«™ä¸åœ¨å½“前列表中
//                        {   //tempid==dev_id è¯´æ˜ŽåŸºç«™ä¸‹å‘测距报文有这个标签的信息
//                            taglist_num++;          //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况
//                            tagid_list[taglist_pos] = tag_id_recv;
//                        }
//                        break;
//                                        }
//            }
//            if(i==rec_nearbase_num)
//            {
//
//                seize_anchor=1;   //抢占anchor
//                Anchor_RecNearPoll(i);
//                              UWB_qiangzhanfachu_count++;
//            }
//                        recev_error_num=0;
////            sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US));//测试
////            LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d ä¿¡å·å¼ºåº¦ï¼š%d.\r\n",g_com_map[BIND_DEV_ID],distance,rssi);
//
//                }
//      //  uwb_rxflag=uwb_rx(0, 0, range_timeout_us);
//    }
//        #ifdef DEBUG_BOXING
////        gpio_pin_clr(IO_PIN_5);//测试
//        gpio_pin_set(IO_PIN_5);//测试
//        #endif
                }
            }
            for(i=0; i<rec_nearbase_num; i++)
            {
                                memcpy(&tempid,&rx_buf[FZ_NEARBASEID_INDEX+i*2],2);
                    if(tempid==dev_id)
                    {
                        Anchor_RecNearPoll(i);
                                      tagdist_list[taglist_pos]=rec_ancdistlist[i];
                        if(group_min_dist[group_id]>rec_ancdistlist[i])
                        {
                            group_min_dist[group_id] = rec_ancdistlist[i];
                        }
                        if(taglist_pos==taglist_num)// taglist_pos==taglist_num è¯´æ˜Žè¿™ä¸ªåŸºç«™ä¸åœ¨å½“前列表中
                        {   //tempid==dev_id è¯´æ˜ŽåŸºç«™ä¸‹å‘测距报文有这个标签的信息
                            taglist_num++;          //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况
                            tagid_list[taglist_pos] = tag_id_recv;
                        }
                        break;
                                        }
            }
            if(i==rec_nearbase_num)
            {
                seize_anchor=1;   //抢占anchor
                Anchor_RecNearPoll(i);
                              UWB_qiangzhanfachu_count++;
            }
                        recev_error_num=0;
//            sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US));//测试
//            LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d ä¿¡å·å¼ºåº¦ï¼š%d.\r\n",g_com_map[BIND_DEV_ID],distance,rssi);
                }
      //  uwb_rxflag=uwb_rx(0, 0, range_timeout_us);
    }
        #ifdef DEBUG_BOXING
//        gpio_pin_clr(IO_PIN_5);//测试
//        gpio_pin_set(IO_PIN_5);//测试
        #endif
    delay_us(1);
    uwb_rx_force_off(1);
//        gpio_pin_clr(IO_PIN_5);
//        #ifdef DEBUG_BOXING
//        gpio_pin_clr(IO_PIN_5);//测试.
//        #endif
//        if(!flag_recsuccess)
//        {
//            sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US-3));//测试
//        LOG_INFO(TRACE_MODULE_APP,"测距失败,计数:%d\r\n",recev_error_num);
//        if(recev_error_num++>5)
//        {
//            recev_error_num=0;
//            UWB_work_state=SEARCH_DEV;
//            uwb_searchcount = 0;
//            search_open_flag = 1;
//        }
//            }
//        #ifdef DEBUG_BOXING
//        gpio_pin_clr(IO_PIN_5);//测试
////        gpio_pin_set(IO_PIN_5);//测试
//        #endif
}
//        #endif
//
//    delay_us(1);
//    uwb_rx_force_off(1);
////        gpio_pin_clr(IO_PIN_5);
////        #ifdef DEBUG_BOXING
////        gpio_pin_clr(IO_PIN_5);//测试.
////        #endif
////        if(!flag_recsuccess)
////        {
////            sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US-3));//测试
////        LOG_INFO(TRACE_MODULE_APP,"测距失败,计数:%d\r\n",recev_error_num);
////        if(recev_error_num++>5)
////        {
////            recev_error_num=0;
////            UWB_work_state=SEARCH_DEV;
////            uwb_searchcount = 0;
////            search_open_flag = 1;
////        }
////            }
////        #ifdef DEBUG_BOXING
////        gpio_pin_clr(IO_PIN_5);//测试
//////        gpio_pin_set(IO_PIN_5);//测试
////        #endif
//}
int Uwbinit(void)
{
    uwb_open();
        // Set calibration parameters
        uwb_open();
    #ifdef STS_MODE
 // Set STS key and IV
    phy_sts_key_configure(&sts_iv_key);
    // which RX ports will be used for AoA/PDoA
    phy_rx_ant_mode_set(RX_ANT_PORTS_COMBINATION);
    #endif
    // Set calibration parameters
    uwb_calibration_params_set(config.phy_cfg.ch_num);
    // set advanced parameters
     struct PHY_ADV_CONFIG_T adv_config = {
    #ifndef STS_MODE
   // set advanced parameters
    struct PHY_ADV_CONFIG_T adv_config = {
        .thres_fap_detect = 40,
        .nth_scale_factor = 4,
        .ranging_performance_mode = 0,
        .skip_weakest_port_en = 0,
    };
    #else
     // set advanced parameters
    struct PHY_ADV_CONFIG_T adv_config = {
        .thres_fap_detect = 40,
        .nth_scale_factor = 4,
        .ranging_performance_mode = 3,
        .skip_weakest_port_en = 0,
    };
    #endif
    phy_adv_params_configure(&adv_config);
    // uwb configure
    uwb_configure(config.phy_work_mode, board_param.tx_power_fcc[CALIB_CH(config.phy_cfg.ch_num)], &config.phy_cfg);
        #if (defined STS_MODE) || (defined MK_MODE)
        ranging_lib_init();
        #endif
    ranging_frame_type_set(config.phy_cfg.sts_pkt_cfg);
        #ifdef STS_MODE
        aoa_aux_info_set(AOA_AUX_ANT_IQ_RSSI_PDOA_AOA_FOM);
    aoa_steering_vector_set((const float *)((uint32_t)((config.phy_cfg.ch_num == 9) ? svec_ch9_ptr : svec_ch5_ptr) | SRAM_BASE));
    // Register rx interrupt callback function
    mac_register_process_handler(tx_int_callback, rx_int_callback);
    aoa_param_config();
        phy_rx_sts_switch_mode_set(config.phy_cfg.sts_pkt_cfg, STS_SWITCH_EVERY_4SYM, 0, 0);
        #endif
        mac_register_process_handler(tx_int_callback, rx_int_callback);//初始化回调
}
uint16_t g_com_receive_id;
void CloseUWB(void)
@@ -690,56 +791,80 @@
}
enumwltagstate wltag_state=RANGE;
uint32_t wltag_statetimer,wltag_uwbtimer;
uint16_t time_flag;
int uwb_app_poll(void)
{
    switch(wltag_state)
    {
    case RANGE:
    if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==0)
        {
                wltag_uwbtimer = HIDO_TimerGetTick();
                OpenUWB();
        }
    else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1)
        {
                wltag_uwbtimer = HIDO_TimerGetTick();
                CloseUWB();
        }
        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();
//    switch(wltag_state)
//    {
//
//    case RANGE:
////    time_flag=HIDO_TimerGetTick()-wltag_uwbtimer;
//    if(HIDO_TimerGetTick()-wltag_uwbtimer>2&&uwb_rx_flag==0)
//        {
////
//
//                UWB_LED_ON;
//                wltag_uwbtimer = HIDO_TimerGetTick();
//                if(UWB_STATE==UWB_STATE_IDLE)
//                {
//                    UWB_STATE=UWB_RX_STATE_BUSY;
//                    OpenUWB();
//                }
//        }
//    else if(HIDO_TimerGetTick()-wltag_uwbtimer>1&&uwb_rx_flag==1)
//        {
////            time_flag=HIDO_TimerGetTick()-wltag_uwbtimer;
//              UWB_LED_OFF;
//                wltag_uwbtimer = HIDO_TimerGetTick();
//                CloseUWB();
//              UWB_STATE=UWB_STATE_IDLE;
//        }
//        if(uwb_losttimer>g_com_map[UWB_RNAGE_TIME])
//        {
//         wltag_statetimer = HIDO_TimerGetTick();
//            if(uwb_rx_flag==0)//若要切换到搜索模式时没有开启则开启UWB
//            {
//                if(UWB_STATE==UWB_STATE_IDLE)
//                {
//                    UWB_STATE=UWB_RX_STATE_BUSY;
//                    OpenUWB();
//                }
//            }
//     wltag_state = SEARCH;
//        }
//        break;
//    case SEARCH:
//        if(HIDO_TimerGetTick()-wltag_statetimer>1)
//        {
//            wltag_statetimer = HIDO_TimerGetTick();
//            wltag_state = CLOSE;
//            CloseUWB();
//            UWB_STATE=UWB_STATE_IDLE;
//        }
//        break;
//    case CLOSE:
//        if(HIDO_TimerGetTick()-wltag_statetimer>g_com_map[UWB_WAIT_TIME])
//        {
//            wltag_statetimer = HIDO_TimerGetTick();
//            wltag_state = SEARCH;
//            if(UWB_STATE==UWB_STATE_IDLE)
//            {
//                UWB_STATE=UWB_RX_STATE_BUSY;
//                OpenUWB();
//            }
//        }
//        break;
//    }
//     UWBIdleTask();
}
int Anchor_App(void)
{
                uint8_t i;
                uint16_t tempid;
            if(group_id==rx_buf[GROUP_ID_IDX]&&rx_buf[MESSAGE_TYPE_IDX] == MBX_POLL)//判断是否是和自己是同一组通讯的且为poll包
        {    flag_recsuccess = 1;
            if(group_id==(rx_buf[GROUP_ID_IDX])&&rx_buf[MESSAGE_TYPE_IDX] == MBX_POLL)//判断是否是和自己是同一组通讯的且为poll包
        {
                        flag_recsuccess = 1;
                        wltag_state=RANGE;//成功后从search切换为range
                        memcpy(&g_com_receive_id,&rx_buf[TAG_ID_IDX],2);
                      //temp_count2=phy_timer_count_get();
@@ -751,40 +876,18 @@
            memcpy(rec_ancidlist,&rx_buf[FZ_NEARBASEID_INDEX],2*rec_nearbase_num);
            memcpy(rec_ancdistlist,&rx_buf[FZ_NEARBASEID_INDEX+2*rec_nearbase_num],2*rec_nearbase_num);
            memcpy(&rec_antdelay,&rx_buf[FZ_NEARBASEID_INDEX+rec_nearbase_num*4],2);
//            for(i=0; i<rec_nearbase_num; i++)
//            {
//                if(rec_ancidlist[i] == dev_id)
//                {        temp_recdist_before_offset=rec_ancdistlist[i];
//                    rec_ancdistlist[i]+=(int16_t)g_com_map[DIST_OFFSET];
//                    PushAnchorDataArray(tag_id_recv,rec_ancdistlist[i],battary);
//                }
//            }
//            for(i=0; i<rec_nearbase_num; i++)
//            {
//                memcpy(&tempid,&rx_buf[FZ_NEARBASEID_INDEX+i*2],2);
//                if(tempid==dev_id)//也是比id如果有就更新没有就抢占
//                {
//                    seize_anchor=0;  //非抢占。已存在列表中
//                    Anchor_RecNearPoll(i);
//                    break;
//                }
//            }
//            if(i==rec_nearbase_num)
//            {
//                seize_anchor=1;   //抢占anchor
//                Anchor_RecNearPoll(i);
//            }
                                taglist_pos=CmpTagInList(tag_id_recv);
                if(taglist_num>=ANC_MAX_NUM)
                        taglist_pos=CmpTagInList(tag_id_recv);
            if(taglist_num>=ANC_MAX_NUM)
                                        return 0;
                                 for(i=0; i<rec_nearbase_num; i++)
                        for(i=0; i<rec_nearbase_num; i++)
                                {
                                        memcpy(&tempid,&rx_buf[FZ_NEARBASEID_INDEX+i*2],2);
                                        if(tempid==dev_id)
                                        {
                                              UWB_shoudao_count++;
                                                Anchor_RecNearPoll(i);
                                                tagdist_list[taglist_pos]=rec_ancdistlist[i];
//                                              UWB_LED_OFF;
                                                if(taglist_pos==taglist_num)// taglist_pos==taglist_num è¯´æ˜Žè¿™ä¸ªåŸºç«™ä¸åœ¨å½“前列表中
                                                {   //tempid==dev_id è¯´æ˜ŽåŸºç«™ä¸‹å‘测距报文有这个标签的信息
                                                        taglist_num++;          //满足上述两种情况才会添加基站ID进入列表中,否则会出现标签不在基站列表中,标签也不响应的情况
@@ -798,6 +901,13 @@
                       Anchor_RecNearPoll(rec_nearbase_num);
                }
                }
    else{
    if(UWB_STATE==UWB_STATE_IDLE)
    {
     UWB_STATE=UWB_RX_STATE_BUSY;
     OpenUWB();
    }
    }
                
                
}
@@ -950,4 +1060,24 @@
    }
    return 1;
}
//typedef enum {
//    UWB_STATE_IDLE,UWB_STATE = UWB_RX_READY;
//    UWB_TX_STATE_BUSY,
//    UWB_RX_STATE_BUSY
//} UWB_State_t;
//void UWB_Process(void) {
//    switch (UWB_STATE) {
//        case UWB_STATE_IDLE:
//               UWB_STATE = UWB_TX_STATE_BUSY;
//            break;
//        case UWB_TX_STATE_BUSY:
//            break;
//        case UWB_RX_STATE_BUSY:
//            UWB_RX_Start();
//            uwb_state = UWB_STATE_IDLE; // è¿›å…¥ RX åŽå›žåˆ°ç©ºé—²çŠ¶æ€
//            break;
//    }
//}
keil/uwb_simple_example.uvoptx
@@ -120,7 +120,7 @@
        <SetRegEntry>
          <Number>0</Number>
          <Key>DLGUARM</Key>
          <Name></Name>
          <Name>d</Name>
        </SetRegEntry>
        <SetRegEntry>
          <Number>0</Number>
@@ -148,319 +148,114 @@
          <Name></Name>
        </SetRegEntry>
      </TargetDriverDllRegistry>
      <Breakpoint>
        <Bp>
          <Number>0</Number>
          <Type>0</Type>
          <LineNumber>642</LineNumber>
          <EnabledFlag>1</EnabledFlag>
          <Address>50966</Address>
          <ByteObject>0</ByteObject>
          <HtxType>0</HtxType>
          <ManyObjects>0</ManyObjects>
          <SizeOfObject>0</SizeOfObject>
          <BreakByAccess>0</BreakByAccess>
          <BreakIfRCount>1</BreakIfRCount>
          <Filename>D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-杩涘彛lora\keil\include\main\main.c</Filename>
          <ExecCommand></ExecCommand>
          <Expression>\\uwb_simple_example\include/main/main.c\642</Expression>
        </Bp>
        <Bp>
          <Number>1</Number>
          <Type>0</Type>
          <LineNumber>644</LineNumber>
          <EnabledFlag>1</EnabledFlag>
          <Address>50970</Address>
          <ByteObject>0</ByteObject>
          <HtxType>0</HtxType>
          <ManyObjects>0</ManyObjects>
          <SizeOfObject>0</SizeOfObject>
          <BreakByAccess>0</BreakByAccess>
          <BreakIfRCount>1</BreakIfRCount>
          <Filename>D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ChinaUWBProject-biaoqian-RX - BT-杩涘彛lora\keil\include\main\main.c</Filename>
          <ExecCommand></ExecCommand>
          <Expression>\\uwb_simple_example\include/main/main.c\644</Expression>
        </Bp>
        <Bp>
          <Number>2</Number>
          <Type>0</Type>
          <LineNumber>633</LineNumber>
          <EnabledFlag>1</EnabledFlag>
          <Address>0</Address>
          <ByteObject>0</ByteObject>
          <HtxType>0</HtxType>
          <ManyObjects>0</ManyObjects>
          <SizeOfObject>0</SizeOfObject>
          <BreakByAccess>0</BreakByAccess>
          <BreakIfRCount>0</BreakIfRCount>
          <Filename>&lt;1&gt;.\include\main\main.c</Filename>
          <ExecCommand></ExecCommand>
          <Expression></Expression>
        </Bp>
        <Bp>
          <Number>3</Number>
          <Type>0</Type>
          <LineNumber>635</LineNumber>
          <EnabledFlag>1</EnabledFlag>
          <Address>0</Address>
          <ByteObject>0</ByteObject>
          <HtxType>0</HtxType>
          <ManyObjects>0</ManyObjects>
          <SizeOfObject>0</SizeOfObject>
          <BreakByAccess>0</BreakByAccess>
          <BreakIfRCount>0</BreakIfRCount>
          <Filename>&lt;1&gt;.\include\main\main.c</Filename>
          <ExecCommand></ExecCommand>
          <Expression></Expression>
        </Bp>
      </Breakpoint>
      <Breakpoint/>
      <WatchWindow1>
        <Ww>
          <count>0</count>
          <WinNumber>1</WinNumber>
          <ItemText>distance,0x0A</ItemText>
          <ItemText>temp_count,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>1</count>
          <WinNumber>1</WinNumber>
          <ItemText>alarm_type</ItemText>
          <ItemText>poll_rx_en_start_u32,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>2</count>
          <WinNumber>1</WinNumber>
          <ItemText>gps_power_state,0x0A</ItemText>
          <ItemText>temp_count1,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>3</count>
          <WinNumber>1</WinNumber>
          <ItemText>bat_percent,0x0A</ItemText>
          <ItemText>resp_tx_en_start_u32,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>4</count>
          <WinNumber>1</WinNumber>
          <ItemText>fVoltage_mv,0x0A</ItemText>
          <ItemText>flag_temp2</ItemText>
        </Ww>
        <Ww>
          <count>5</count>
          <WinNumber>1</WinNumber>
          <ItemText>g_com_map</ItemText>
          <ItemText>temp_rx</ItemText>
        </Ww>
        <Ww>
          <count>6</count>
          <WinNumber>1</WinNumber>
          <ItemText>mUsartReceivePack</ItemText>
          <ItemText>rx_buf</ItemText>
        </Ww>
        <Ww>
          <count>7</count>
          <WinNumber>1</WinNumber>
          <ItemText>flag_sleeptimer</ItemText>
          <ItemText>tag_id_recv</ItemText>
        </Ww>
        <Ww>
          <count>8</count>
          <WinNumber>1</WinNumber>
          <ItemText>current_count,0x0A</ItemText>
          <ItemText>rec_ancdistlist,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>9</count>
          <WinNumber>1</WinNumber>
          <ItemText>rx_rpt,0x10</ItemText>
          <ItemText>poll_rx_num</ItemText>
        </Ww>
        <Ww>
          <count>10</count>
          <WinNumber>1</WinNumber>
          <ItemText>end_receive_count,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>11</count>
          <WinNumber>1</WinNumber>
          <ItemText>\\uwb_simple_example\../keil/uwb_app.c\current_count,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>12</count>
          <WinNumber>1</WinNumber>
          <ItemText>UWB_work_state,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>13</count>
          <WinNumber>1</WinNumber>
          <ItemText>rx_rpt,0x10</ItemText>
        </Ww>
        <Ww>
          <count>14</count>
          <WinNumber>1</WinNumber>
          <ItemText>temp_count,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>15</count>
          <WinNumber>1</WinNumber>
          <ItemText>temp_count3,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>16</count>
          <WinNumber>1</WinNumber>
          <ItemText>mUsart2ReceivePack</ItemText>
        </Ww>
        <Ww>
          <count>17</count>
          <WinNumber>1</WinNumber>
          <ItemText>gps_prase_flag</ItemText>
        </Ww>
        <Ww>
          <count>18</count>
          <WinNumber>1</WinNumber>
          <ItemText>uwb_searchcount,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>19</count>
          <WinNumber>1</WinNumber>
          <ItemText>wd</ItemText>
        </Ww>
        <Ww>
          <count>20</count>
          <WinNumber>1</WinNumber>
          <ItemText>jd</ItemText>
        </Ww>
        <Ww>
          <count>21</count>
          <WinNumber>1</WinNumber>
          <ItemText>pos_state,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>22</count>
          <WinNumber>1</WinNumber>
          <ItemText>ret</ItemText>
        </Ww>
        <Ww>
          <count>23</count>
          <WinNumber>1</WinNumber>
          <ItemText>successful_cnt,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>24</count>
          <WinNumber>1</WinNumber>
          <ItemText>error_cnt,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>25</count>
          <WinNumber>1</WinNumber>
          <ItemText>ceshi,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>26</count>
          <WinNumber>1</WinNumber>
          <ItemText>io14_state</ItemText>
        </Ww>
        <Ww>
          <count>27</count>
          <WinNumber>1</WinNumber>
          <ItemText>RxDoneParams</ItemText>
        </Ww>
        <Ww>
          <count>28</count>
          <WinNumber>1</WinNumber>
          <ItemText>rec_nearbase_num</ItemText>
        </Ww>
        <Ww>
          <count>29</count>
          <WinNumber>1</WinNumber>
          <ItemText>uwb_rxflag,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>30</count>
          <WinNumber>1</WinNumber>
          <ItemText>resp_tx_num</ItemText>
        </Ww>
        <Ww>
          <count>31</count>
          <WinNumber>1</WinNumber>
          <ItemText>timeceshi1,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>32</count>
          <WinNumber>1</WinNumber>
          <ItemText>temp_count7,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>33</count>
          <WinNumber>1</WinNumber>
          <ItemText>temp_count3,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>34</count>
          <WinNumber>1</WinNumber>
          <ItemText>uwb_rxflag_num,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>35</count>
          <WinNumber>1</WinNumber>
          <ItemText>rec_ancidlist</ItemText>
        </Ww>
        <Ww>
          <count>36</count>
          <WinNumber>1</WinNumber>
          <ItemText>rec_ancdistlist</ItemText>
        </Ww>
        <Ww>
          <count>37</count>
          <WinNumber>1</WinNumber>
          <ItemText>rx_rpt</ItemText>
        </Ww>
        <Ww>
          <count>38</count>
          <WinNumber>1</WinNumber>
          <ItemText>current_count</ItemText>
        </Ww>
        <Ww>
          <count>39</count>
          <WinNumber>1</WinNumber>
          <ItemText>end_receive_count</ItemText>
        </Ww>
        <Ww>
          <count>40</count>
          <WinNumber>1</WinNumber>
          <ItemText>rec_nearbase_num</ItemText>
          <ItemText>temp_count3</ItemText>
        </Ww>
      </WatchWindow1>
      <WatchWindow2>
        <Ww>
          <count>0</count>
          <WinNumber>2</WinNumber>
          <ItemText>DMA_RXBuf_BT</ItemText>
          <ItemText>poll_rx_num</ItemText>
        </Ww>
        <Ww>
          <count>1</count>
          <WinNumber>2</WinNumber>
          <ItemText>buffer</ItemText>
          <ItemText>rec_nearbase_num</ItemText>
        </Ww>
        <Ww>
          <count>2</count>
          <WinNumber>2</WinNumber>
          <ItemText>txBuffer</ItemText>
          <ItemText>UWB_STATE</ItemText>
        </Ww>
        <Ww>
          <count>3</count>
          <WinNumber>2</WinNumber>
          <ItemText>rx_buf</ItemText>
          <ItemText>wltag_uwbtimer,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>4</count>
          <WinNumber>2</WinNumber>
          <ItemText>txBuffer</ItemText>
          <ItemText>time_flag</ItemText>
        </Ww>
        <Ww>
          <count>5</count>
          <WinNumber>2</WinNumber>
          <ItemText>buf</ItemText>
          <ItemText>tagid_list</ItemText>
        </Ww>
        <Ww>
          <count>6</count>
          <WinNumber>2</WinNumber>
          <ItemText>command</ItemText>
          <ItemText>tagdist_list</ItemText>
        </Ww>
        <Ww>
          <count>7</count>
          <WinNumber>2</WinNumber>
          <ItemText>buf</ItemText>
          <ItemText>rec_ancdistlist</ItemText>
        </Ww>
        <Ww>
          <count>8</count>
          <WinNumber>2</WinNumber>
          <ItemText>rec_nearbase_num</ItemText>
        </Ww>
        <Ww>
          <count>9</count>
          <WinNumber>2</WinNumber>
          <ItemText>UWB_shoudao_count</ItemText>
        </Ww>
      </WatchWindow2>
      <MemoryWindow1>
@@ -946,7 +741,7 @@
  <Group>
    <GroupName>Main</GroupName>
    <tvExp>0</tvExp>
    <tvExp>1</tvExp>
    <tvExpOptDlg>0</tvExpOptDlg>
    <cbSel>0</cbSel>
    <RteFlg>0</RteFlg>
@@ -1354,7 +1149,7 @@
  <Group>
    <GroupName>Internet</GroupName>
    <tvExp>1</tvExp>
    <tvExp>0</tvExp>
    <tvExpOptDlg>0</tvExpOptDlg>
    <cbSel>0</cbSel>
    <RteFlg>0</RteFlg>
@@ -1446,7 +1241,7 @@
  <Group>
    <GroupName>Hal</GroupName>
    <tvExp>1</tvExp>
    <tvExp>0</tvExp>
    <tvExpOptDlg>0</tvExpOptDlg>
    <cbSel>0</cbSel>
    <RteFlg>0</RteFlg>