Commit f2e78d45 authored by 李冠华's avatar 李冠华

🐞 fix:修改上下电时间

parent 3fc554e9
......@@ -4,6 +4,7 @@
uint16_t PowerCountNum = 0U;
uint8_t KL1530ON = 0U;
uint8_t ControlsStatus = DUAN_DIAN_STATE;
uint16_t ShangDianOffset = 0u;
void Power_Controls_Init(void)
......@@ -13,22 +14,30 @@ void Power_Controls_Init(void)
void Power_Control_Count(void)
{
// if (PowerCountNum <= 250U)
// {
// KL1530ON = 1U;
// PowerCountNum ++;
// }
// else if ((PowerCountNum > 250U) && (PowerCountNum < 300U))
// {
// KL1530ON = 0U;
// PowerCountNum ++;
// }
// else
// {
// KL1530ON = 0U;
// PowerCountNum = 0U;
// }
if (PowerCountNum <= (SHANG_DIAN_TIMES + ShangDianOffset))
{
KL1530ON = 1U;
PowerCountNum ++;
}
else if ((PowerCountNum > (SHANG_DIAN_TIMES + ShangDianOffset)) && (PowerCountNum < (SHANG_DIAN_TIMES + ShangDianOffset + DUAN_DIAN_TIMES)))
{
KL1530ON = 0U;
PowerCountNum ++;
}
else
{
KL1530ON = 0U;
PowerCountNum = 0U;
if(ShangDianOffset < 900U)
{
/*上电总时长小于90s+25s*/
ShangDianOffset = ((ShangDianOffset + 5) *100 / 7);
}
else
{
ShangDianOffset /= 100;
}
}
}
......
......@@ -9,7 +9,8 @@
#include "Task.h"
#define DUAN_DIAN_STATE 1 /*0--只控制13.5V电,1--控制所有电*/
#define SHANG_DIAN_TIMES 250U /*上电时间*/
#define DUAN_DIAN_TIMES 30U /*断电时长,3s*/
extern uint8_t KL1530ON;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment