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();