From 00fc23c0b2c7b7dfd6df3e9fb9e385ec949cd8cc Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期五, 08 九月 2023 11:31:10 +0800 Subject: [PATCH] lora发30次,先提交一下,方便测试 --- Core/Src/main.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Core/Src/main.c b/Core/Src/main.c index d55f25d..45dc53f 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -258,6 +258,10 @@ if(lp_time-battery_timer>=60) { bat_percent=Battery_GetPercentage(); + if(bat_percent>100) + { + bat_percent=100; + } battery_timer=lp_time; } } @@ -311,7 +315,7 @@ MX_SPI1_Init(); MX_TIM21_Init(); MX_LPTIM1_Init(); - MX_IWDG_Init(); +// MX_IWDG_Init(); /* USER CODE BEGIN 2 */ Program_Init(); #ifndef UWB_OFF_FANGCHAI_ON @@ -330,7 +334,7 @@ HAL_Delay(500); Set4LEDColor(GREEN,GREEN,GREEN,GREEN); HAL_Delay(500); - MX_IWDG_Init(); +// MX_IWDG_Init(); // NVIC_SystemReset(); /* USER CODE END 2 */ @@ -338,7 +342,7 @@ /* USER CODE BEGIN WHILE */ while (1) { - HAL_IWDG_Refresh(&hiwdg); +// HAL_IWDG_Refresh(&hiwdg); APL_Poll();//lora接收,gps接收时间判断,单片机休眠函数,蜂鸣器判断函数。 #ifndef UWB_OFF_FANGCHAI_ON Uwb_Poll(); @@ -370,7 +374,7 @@ /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); - __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); + __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH); /** Initializes the RCC Oscillators according to the specified parameters * in the RCC_OscInitTypeDef structure. */ @@ -779,8 +783,8 @@ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - /*Configure GPIO pins : PB1 PB5 PB7 PB9 */ - GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_5|GPIO_PIN_7|GPIO_PIN_9; + /*Configure GPIO pins : PB1 PB5 PB7 */ + GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_5|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); @@ -836,8 +840,8 @@ lp_time++; nomove_time++;//设备没有移动的时间 if(nomove_time>g_com_map[NOMOVESLEEP_TIME]) - {nomove_flag=1;} -// {} +// {nomove_flag=1;} + {} else {nomove_flag=0;} if(lora_sendfinal_rx_bag_flag==1)//如果进入lora等待接收回复的状态 -- Gitblit v1.9.3