From d49f35ffeba891332ea07b3f478886ebae0a980d Mon Sep 17 00:00:00 2001 From: 95384 <664090429@qq.com> Date: Mon, 20 Jan 2025 15:06:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6=E9=87=8D?= =?UTF-8?q?=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Src/anemometer_dev.c | 8 -------- Core/Src/freertos.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/App/Src/anemometer_dev.c b/App/Src/anemometer_dev.c index 2a45d42..33f66d8 100644 --- a/App/Src/anemometer_dev.c +++ b/App/Src/anemometer_dev.c @@ -1069,7 +1069,6 @@ void tem_hum_update_task(void const * argument) uint8_t tem_hun_check_flag = JudgeEncrypt(); uint16_t time_s_temp_humi = 0;//1秒计时,温湿度更新 - uint32_t time_s_1Day = 0;//1天的秒数 float backupTemperature; uint8_t hp203_ret; @@ -1100,7 +1099,6 @@ void tem_hum_update_task(void const * argument) osDelay(1000); if(!tem_hun_check_flag)continue; time_s_temp_humi ++; - time_s_1Day ++; // 温湿度大气压更新 if (time_s_temp_humi >= g_usrConfigInfo.temp_hum_update_time) { @@ -1132,12 +1130,6 @@ void tem_hum_update_task(void const * argument) // 计时重置 time_s_temp_humi = 0; } -// 一天重启 - if (time_s_1Day >= 86400) - { - __iar_builtin_set_FAULTMASK(1); - NVIC_SystemReset(); - } // 风速风向更新 my_update_mcs_param(weather_info.instantaneous_wind_speed, weather_info.instantaneous_wind_direction); } diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index b37fcd7..7f57e69 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -188,6 +188,8 @@ void SensorTask(void const * argument) } /* USER CODE END Application */ + uint16_t time_s_1Hour = 0;//1Сʱ + uint8_t time_h_1Day = 0;//1Сʱ void LEDTask(void const * argument) { /* USER CODE BEGIN StartDefaultTask */ @@ -196,9 +198,22 @@ void LEDTask(void const * argument) for(;;) { osDelay(1000); + time_s_1Hour ++; if(LED_Check_flag) { HAL_GPIO_TogglePin(GPIOC,GPIO_LED_CTRL_Pin); + // һ + if (time_s_1Hour >= 3600) + { + time_s_1Hour = 0; + time_h_1Day++; + } + if (time_h_1Day >= 24) + { + time_h_1Day = 0; + __iar_builtin_set_FAULTMASK(1); + NVIC_SystemReset(); + } } } /* USER CODE END StartDefaultTask */