|
本帖最后由 peter58 于 2017-9-3 17:55 编辑
你好,按照你源程序改了一个定时关闭,现在有个问题,在小时段 同时设置在同一时段就不起作用,比如:定时开设置到8:30开 ,定时关设置到8:32关 就不起作用,如果单独的用定时开或者定时关就没问题,只要小时不在一个时段上就没问题,搞了几天一点头绪都没有,请有空帮我看看怎么改,我把定时程序帖上来,谢谢!!
(定时数据点就在你原来的名字后面多加了一个字母;houra小时,delayb分)谢谢问题已解决,自已基础太差,多加个定义就OK了,增加了个timeoff_flag
//============定时开===========
gagentGetNTP(&ntptimeStr);
os_printf("gagentntp seco: %d",ntptimeStr.second);
if((currentDataPoint.valuetimeon_hour != 0) || (currentDataPoint.valuetimeon_min != 0))
{
if(ntptimeStr.hour == currentDataPoint.valuetimeon_hour)
if(ntptimeStr.minute == currentDataPoint.valuetimeon_min)
{
if(timeon_flag == 0)
{
GPIO_OUTPUT_SET(GPIO_ID_PIN(12), 1);
currentDataPoint.valueswitchcontrol = 1;
timeon_flag = 1;
}
}
else
{
timeon_flag = 0;
}
}
//=========定时关=======================
gagentGetNTP(&ntptimeStr);
os_printf("gagentntp secon: %d",ntptimeStr.second);
if((currentDataPoint.valuetimeon_houra != 0) || (currentDataPoint.valuetimeon_minb != 0))
{
if(ntptimeStr.hour == currentDataPoint.valuetimeon_houra)
if(ntptimeStr.minute == currentDataPoint.valuetimeon_minb)
{
if(timeon_flag == 1)
{
GPIO_OUTPUT_SET(GPIO_ID_PIN(12), 0);
currentDataPoint.valueswitchcontrol = 0;
timeon_flag = 0;
}
}
else
{
timeon_flag = 1;
}
}
//====================================
|
-
111.jpg
(201.39 KB, 下载次数: 934)
控制APP
|