修改定时重启

This commit is contained in:
95384 2025-01-20 15:06:07 +08:00
parent 980d3a2429
commit d49f35ffeb
2 changed files with 15 additions and 8 deletions

View File

@ -1069,7 +1069,6 @@ void tem_hum_update_task(void const * argument)
uint8_t tem_hun_check_flag = JudgeEncrypt(); uint8_t tem_hun_check_flag = JudgeEncrypt();
uint16_t time_s_temp_humi = 0;//1秒计时温湿度更新 uint16_t time_s_temp_humi = 0;//1秒计时温湿度更新
uint32_t time_s_1Day = 0;//1天的秒数
float backupTemperature; float backupTemperature;
uint8_t hp203_ret; uint8_t hp203_ret;
@ -1100,7 +1099,6 @@ void tem_hum_update_task(void const * argument)
osDelay(1000); osDelay(1000);
if(!tem_hun_check_flag)continue; if(!tem_hun_check_flag)continue;
time_s_temp_humi ++; time_s_temp_humi ++;
time_s_1Day ++;
// 温湿度大气压更新 // 温湿度大气压更新
if (time_s_temp_humi >= g_usrConfigInfo.temp_hum_update_time) 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; 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); my_update_mcs_param(weather_info.instantaneous_wind_speed, weather_info.instantaneous_wind_direction);
} }

View File

@ -188,6 +188,8 @@ void SensorTask(void const * argument)
} }
/* USER CODE END Application */ /* USER CODE END Application */
uint16_t time_s_1Hour = 0;//1小时的秒数
uint8_t time_h_1Day = 0;//1天的小时
void LEDTask(void const * argument) void LEDTask(void const * argument)
{ {
/* USER CODE BEGIN StartDefaultTask */ /* USER CODE BEGIN StartDefaultTask */
@ -196,9 +198,22 @@ void LEDTask(void const * argument)
for(;;) for(;;)
{ {
osDelay(1000); osDelay(1000);
time_s_1Hour ++;
if(LED_Check_flag) if(LED_Check_flag)
{ {
HAL_GPIO_TogglePin(GPIOC,GPIO_LED_CTRL_Pin); 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 */ /* USER CODE END StartDefaultTask */