From fbff960e30c1771d1b16ad03eb2cc1a3ec3e58e4 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期四, 24 七月 2025 11:21:19 +0800 Subject: [PATCH] 1.0 --- Src/main.c | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Src/main.c b/Src/main.c index 9e00373..2e44558 100644 --- a/Src/main.c +++ b/Src/main.c @@ -115,9 +115,15 @@ uint16_t hardware_version,hardware_pici,hardware_type; u16 current_time; uint8_t state5v; +uint8_t uart_time; +uint8_t uart_init_flag; void IdleTask(void) { - + if(uart_init_flag) + { + UsartInit(); + uart_init_flag=0; + } UART_CheckReceive(); UART_CheckSend(); @@ -133,7 +139,7 @@ // LED_TR_OFF; current_time=GetLPTime(); //motor_state=2; - + // bat_percent=Get_Battary(); // if(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) // { @@ -239,7 +245,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] = (1<<8)|1; + g_com_map[VERSION] = (1<<8)|0; // g_com_map[DEV_ID]=0x0011; #ifdef DEBUG_MODE @@ -416,6 +422,12 @@ id = dwt_readdevid() ; Dw1000_App_Init(); HardWareTypeDiffConfig(); + dwt_configcontinuousframemode(124800); + dwt_writetxfctrl(13, 0); + while(1) + { + IdleTask(); + } // dwt_configuresleep(DWT_PRESRV_SLEEP | DWT_CONFIG, DWT_WAKE_CS | DWT_WAKE_WK| DWT_SLP_EN); // dwt_entersleep(); // waitusart_timer=tag_frequency*USART_KEEPWAKE_TIME;; @@ -950,6 +962,8 @@ extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag; float key_keeptime; extern float motor_ontime,button_delay; +uint8_t uart_time; +uint8_t uart_init_flag; void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) { static uint8_t i=0; @@ -961,6 +975,12 @@ if(button_delay<1) button_delay+=1/(float)tag_frequency; nomove_count+=1/(float)tag_frequency; + uart_time++; + if(uart_time>60) + { + uart_init_flag=1; + uart_time=0; + } // if(motor_keeptime>0) // { // motor_keeptime-=1/(float)tag_frequency; -- Gitblit v1.9.3