From eddac77c8fa85acccbf6eeff48b1ff760c70843a Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 01 十一月 2023 15:33:01 +0800 Subject: [PATCH] 版本v2.7,大包字节uwb传输测试成功。 --- Src/main.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Src/main.c b/Src/main.c index 578231b..a290b8a 100644 --- a/Src/main.c +++ b/Src/main.c @@ -31,7 +31,7 @@ #define NSH1 0x0001 #define GP 0x0002 -#define DEBUG_MODE +//#define DEBUG_MODE /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -234,7 +234,7 @@ hardware_pici= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2); hardware_type= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4); //deca_sleep(1000); - g_com_map[VERSION] = (2<<8)|4; + g_com_map[VERSION] = (2<<8)|7; // g_com_map[DEV_ID]=0x7; #ifdef DEBUG_MODE @@ -271,13 +271,13 @@ current_time=GetLPTime(); nomovesleep_time = g_com_map[NOMOVESLEEP_TIME]; interval = g_com_map[COM_INTERVAL]; - if(active_flag==0) - { - interval=1000; - imu_enable=1; - nomovesleep_time = 10; - motor_enable=0; - } +// if(active_flag==0) +// { +// interval=1000; +// imu_enable=1; +// nomovesleep_time = 10; +// motor_enable=0; +// } tag_frequency = 1000/interval; if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, slot_startcount) != HAL_OK) //system time is 1010ms 1 puls=30.518us { @@ -354,6 +354,8 @@ { //SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader } +uint8_t i; +uint8_t uwb_tx[300]={0,}; /* USER CODE END 0 */ /** @@ -410,7 +412,10 @@ { Error_Handler(); } - + for(i=0;i<255;i++) + { + uwb_tx[i]=i; + } // HAL_Delay(2000); // mcu_sleep(); @@ -918,6 +923,25 @@ extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag; float key_keeptime; extern float motor_ontime,button_delay; +uint32_t tagdisterror_list[TAG_NUM_IN_SYS]; +extern uint16_t taglist_num; +extern int32_t tagdist_list[TAG_NUM_IN_SYS]; +extern uint16_t tagid_list[TAG_NUM_IN_SYS]; +void Up_tagdisterror_list_Poll() +{ + static uint8_t r=0; + for(r=0;r<taglist_num;r++) + { + tagdisterror_list[r]++; + if(tagdisterror_list[r]>10) + { + tagdist_list[r]=0; + tagid_list[r]=0; + taglist_num=taglist_num-1; + tagdisterror_list[r]=0; + } + } +} void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) { static uint8_t i=0; @@ -928,6 +952,7 @@ if(button_delay<1) button_delay+=1/(float)tag_frequency; nomove_count+=1/(float)tag_frequency; +Up_tagdisterror_list_Poll(); if(motor_keeptime>0) { motor_keeptime-=1/(float)tag_frequency; -- Gitblit v1.9.3