主循环执行定时任务

This commit is contained in:
zogodo
2019-12-25 18:08:26 +08:00
parent 16f3ed0fe4
commit 68450b5bfe
2 changed files with 11 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
#include "mqtt_server/user_mqtt_client.h"
#include "mqtt_server/user_function.h"
#include "http_server/app_httpd.h"
#include "time_task/time_task.h"
#define os_log(format, ...) custom_log("TC1", format, ##__VA_ARGS__); web_log(format, ##__VA_ARGS__)
@@ -167,6 +168,14 @@ int application_start(void)
strMac, (unsigned int)(power2 / 10), (unsigned int)(power2 % 10), (unsigned int)total_time);
user_send(0, power_buf);
user_mqtt_hass_power();
time_t now = time(NULL);
if (now >= task_top->time)
{
os_log("now");
UserRelaySet(task_top->socket_idx, task_top->on);
DelFirstTask();
}
mico_thread_msleep(1000);
}