添加定时发送用闹钟,默认时间为每小时的一刻钟
This commit is contained in:
parent
f4170d06e6
commit
ee3f3302f8
@ -64,18 +64,23 @@ MSH_CMD_EXPORT(alarm_sample,alarm sample);
|
||||
|
||||
void poTT_callback(rt_alarm_t alarm, time_t timestamp)
|
||||
{
|
||||
LOG_D("power UP TT.");
|
||||
LOG_D("power UP TT by RTC.");
|
||||
initTT();
|
||||
setWindowMode();
|
||||
}
|
||||
void pdTT_callback(rt_alarm_t alarm, time_t timestamp)
|
||||
{
|
||||
LOG_D("power DOWN TT.");
|
||||
LOG_D("power DOWN TT by RTC.");
|
||||
deInitTT();
|
||||
}
|
||||
void poTT2_callback(rt_alarm_t alarm, time_t timestamp)
|
||||
{
|
||||
LOG_D("power UP TT by RTC.");
|
||||
initTT();
|
||||
}
|
||||
//每个开窗设置对应两个rtc闹钟,一个上电一个下电
|
||||
//更新开窗设置前需要先清空闹钟设置。可改为调用rt_alarm_control()修改。
|
||||
static struct rt_alarm *alarm[4];//支持2组开窗共4个闹钟
|
||||
static struct rt_alarm *alarm[4+1];//支持2组开窗共4个闹钟,加一个定时发送闹钟
|
||||
#ifndef al
|
||||
void InitAlarm()
|
||||
{
|
||||
@ -122,8 +127,15 @@ void InitAlarm()
|
||||
}
|
||||
alarm[3] = rt_alarm_create(pdTT_callback, &setup);
|
||||
|
||||
setup.flag = RT_ALARM_HOUR;//小时重复
|
||||
setup.wktime.tm_min = 15; //每小时的1刻钟启动发送
|
||||
if (RT_NULL != alarm[4])
|
||||
{
|
||||
rt_alarm_delete(alarm[4]); //
|
||||
}
|
||||
alarm[4] = rt_alarm_create(poTT2_callback, &setup);
|
||||
|
||||
for (size_t var = 0; var < 4; var++) {
|
||||
for (size_t var = 0; var < 5; var++) {
|
||||
if (alarm[var] != RT_NULL) {
|
||||
rt_alarm_start(alarm[var]);
|
||||
// LOG_D("alarm %d(%02d:%02d) started.",var+1,alarm[var]->wktime.tm_hour+8,alarm[var]->wktime.tm_min);
|
||||
@ -202,7 +214,7 @@ void updateAlarm(uint8_t *t, size_t len)
|
||||
if (alarm[var] != RT_NULL) {
|
||||
rt_alarm_start(alarm[var]);
|
||||
// LOG_D("alarm %d started.",var+1);
|
||||
LOG_D("alarm %d(%02d:%02d) started.",var+1,alarm[var]->wktime.tm_hour+8,alarm[var]->wktime.tm_min);
|
||||
LOG_D("alarmer %d(%02d:%02d) started.",var+1,alarm[var]->wktime.tm_hour+8,alarm[var]->wktime.tm_min);
|
||||
}
|
||||
else {
|
||||
LOG_E("Failed to start alarm %d.",var+1);
|
||||
|
@ -292,7 +292,7 @@ static void chkAndSendFile_thread_entry()
|
||||
while (1)
|
||||
{
|
||||
// int e;
|
||||
LOG_I("等待文件就绪(或定时%d分钟超时)",scfg.sendInterval);
|
||||
LOG_I("等待发送条件(文件就绪或定时%d分钟超时)",scfg.sendInterval);
|
||||
if (rt_event_recv(&chkSta, FILE_IS_OK | TIMER_IS_OUT, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
|
||||
RT_WAITING_FOREVER, RT_NULL) == RT_EOK) //条件1满足
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user