huyongji1.1-system/App/paini/paini.c

27 lines
679 B
C

#include "paini.h"
// 全局变量
uint32_t timer_1s_cnt = 0; // 1秒计数器
uint32_t timer_1min_cnt = 0; // 1分钟计数器
uint32_t timer_1hour_cnt = 0; // 1小时计数器
// 排泥控制函数
void Dredge_Control(void)
{
static uint8_t dredge_flag = 0;
if(dredge_flag && timer_1min_cnt >= 5) // 排泥5分钟
{
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_4, GPIO_PIN_RESET); // 关闭排泥
dredge_flag = 0;
timer_1min_cnt = 0;
}
if(timer_1hour_cnt >= 72) // 72小时到
{
timer_1hour_cnt = 0;
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_4, GPIO_PIN_SET); // 开启排泥
dredge_flag = 1;
}
}