From 68450b5bfe3d929229e9cec76bcba65fbe7e871e Mon Sep 17 00:00:00 2001 From: zogodo <742782908@qq.com> Date: Wed, 25 Dec 2019 18:08:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E5=BE=AA=E7=8E=AF=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TC1/main.c | 9 +++++++++ TC1/timed_task/timed_task.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/TC1/main.c b/TC1/main.c index bcff0ee..37a4195 100644 --- a/TC1/main.c +++ b/TC1/main.c @@ -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); } diff --git a/TC1/timed_task/timed_task.h b/TC1/timed_task/timed_task.h index 48a330e..df42354 100644 --- a/TC1/timed_task/timed_task.h +++ b/TC1/timed_task/timed_task.h @@ -13,5 +13,6 @@ struct TimedTask extern pTimedTask task_top; bool AddTask(pTimedTask task); -bool DelTask(); +bool DelTask(int time); +bool DelFirstTask(); char* GetTaskStr();