|
|
@ -38,7 +38,7 @@ struct UserInfo{ |
|
|
|
struct UserInfo userInfo; |
|
|
|
struct UserInfo userInfo; |
|
|
|
struct timing nowTime; |
|
|
|
struct timing nowTime; |
|
|
|
|
|
|
|
|
|
|
|
u8 Settime[6]={0x22,0x04,0x27,0x19,0x17,0x00}; // 设置时间 22年 03月 27日 22:34:00
|
|
|
|
u8 Settime[6]={0x22,0x05,0x18,0x18,0x51,0x00}; // 设置时间 22年 03月 27日 22:34:00
|
|
|
|
|
|
|
|
|
|
|
|
int setModel = 0; |
|
|
|
int setModel = 0; |
|
|
|
int change = 0; |
|
|
|
int change = 0; |
|
|
@ -108,7 +108,7 @@ void Sys_Init(void) |
|
|
|
OLED_Init(); |
|
|
|
OLED_Init(); |
|
|
|
Key4x4_GPIO_Config(); |
|
|
|
Key4x4_GPIO_Config(); |
|
|
|
DS1302_init(Settime); |
|
|
|
DS1302_init(Settime); |
|
|
|
DS1302_SetTime(Settime); |
|
|
|
//DS1302_SetTime(Settime);
|
|
|
|
OLED_Clear(); |
|
|
|
OLED_Clear(); |
|
|
|
bh_data_send(BHPowOn); |
|
|
|
bh_data_send(BHPowOn); |
|
|
|
}
|
|
|
|
}
|
|
|
@ -323,24 +323,34 @@ void TaskProcessing() |
|
|
|
|
|
|
|
|
|
|
|
keyHandling(); |
|
|
|
keyHandling(); |
|
|
|
|
|
|
|
|
|
|
|
if(userInfo.warn == 0) flag = 0; |
|
|
|
|
|
|
|
// 超过时间报警
|
|
|
|
// 超过时间报警
|
|
|
|
if(getTimerResult() && userInfo.warn){ |
|
|
|
if(getTimerResult()){ |
|
|
|
if(flag == 0) { |
|
|
|
if(flag == 0) { |
|
|
|
min = userInfo.SetTimer.min + 1; |
|
|
|
min = userInfo.SetTimer.min; |
|
|
|
sec = userInfo.SetTimer.sec; |
|
|
|
sec = userInfo.SetTimer.sec + 3; |
|
|
|
if(min >= 60){ |
|
|
|
if(sec >= 60){ |
|
|
|
min = min - 60; |
|
|
|
sec = sec - 60; |
|
|
|
|
|
|
|
min += 1; |
|
|
|
|
|
|
|
if(min >= 60) min = min - 60; |
|
|
|
}
|
|
|
|
}
|
|
|
|
flag = 1; |
|
|
|
flag = 1; |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
if(min == nowTime.min && sec == nowTime.sec){ |
|
|
|
if(min == nowTime.min && sec == nowTime.sec){ |
|
|
|
userInfo.warn = 0; |
|
|
|
if(flag == 1){ |
|
|
|
flag = 0; |
|
|
|
userInfo.warn = 0; |
|
|
|
|
|
|
|
min = nowTime.min + 5; |
|
|
|
|
|
|
|
sec = nowTime.sec; |
|
|
|
|
|
|
|
if(min >= 60) min = min - 60; |
|
|
|
|
|
|
|
flag = 2; |
|
|
|
|
|
|
|
}else if(flag == 2){ |
|
|
|
|
|
|
|
flag = 3; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(userInfo.warn) Warning(); |
|
|
|
if(userInfo.warn) Warning(); |
|
|
|
}
|
|
|
|
}else{ |
|
|
|
|
|
|
|
flag = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
LED0 = 0; |
|
|
|
LED0 = 0; |
|
|
|
LED1 = 0; |
|
|
|
LED1 = 0; |
|
|
@ -350,7 +360,8 @@ void TaskProcessing() |
|
|
|
if(userInfo.num >= userInfo.num_th3) LED2 = 1; |
|
|
|
if(userInfo.num >= userInfo.num_th3) LED2 = 1; |
|
|
|
|
|
|
|
|
|
|
|
if(userInfo.light > userInfo.light_threshold) LED0 = 0,LED1 = 0,LED2 = 0; |
|
|
|
if(userInfo.light > userInfo.light_threshold) LED0 = 0,LED1 = 0,LED2 = 0; |
|
|
|
|
|
|
|
if(flag == 3) LED0 = 0,LED1 = 0,LED2 = 0; |
|
|
|
|
|
|
|
|
|
|
|
AT24CXX_WriteOneByte(0, userInfo.SetTimer.hour); |
|
|
|
AT24CXX_WriteOneByte(0, userInfo.SetTimer.hour); |
|
|
|
AT24CXX_WriteOneByte(1, userInfo.SetTimer.min); |
|
|
|
AT24CXX_WriteOneByte(1, userInfo.SetTimer.min); |
|
|
|
AT24CXX_WriteOneByte(2, userInfo.SetTimer.sec); |
|
|
|
AT24CXX_WriteOneByte(2, userInfo.SetTimer.sec); |
|
|
|