mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 13:08:13 +08:00
这样是能用的, 先提交一波
This commit is contained in:
@@ -79,7 +79,9 @@
|
||||
|
||||
<fieldset class="task">
|
||||
<legend>Timed Task</legend>
|
||||
<button onclick="GetTimedTask()">Test</button>
|
||||
<input type="number" id="task_time"/>
|
||||
<button onclick="AddTimedTask()">Add</button>
|
||||
<button onclick="GetTimedTask()">Get</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="chart">
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -179,7 +179,7 @@ int application_start(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
os_log("task_top[%u]");
|
||||
os_log("timed task count[%u]", task_count);
|
||||
}
|
||||
mico_thread_msleep(1000);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include<stdlib.h>
|
||||
#include<string.h>
|
||||
#include<stdbool.h>
|
||||
#include<time.h>
|
||||
#include"timed_task/timed_task.h"
|
||||
|
||||
pTimedTask task_top = NULL;
|
||||
@@ -65,6 +66,7 @@ bool DelTask(int time)
|
||||
pTimedTask tmp = task_top;
|
||||
task_top = task_top->next;
|
||||
free(tmp);
|
||||
task_count--;
|
||||
return true;
|
||||
}
|
||||
else if (task_top->next == NULL)
|
||||
@@ -80,6 +82,8 @@ bool DelTask(int time)
|
||||
{
|
||||
pre_tsk->next = tmp_tsk->next;
|
||||
free(tmp_tsk);
|
||||
task_count--;
|
||||
return true;
|
||||
}
|
||||
tmp_tsk = tmp_tsk->next;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ struct TimedTask
|
||||
};
|
||||
|
||||
extern pTimedTask task_top;
|
||||
extern int task_count;
|
||||
|
||||
bool AddTask(pTimedTask task);
|
||||
bool DelTask(int time);
|
||||
|
||||
Reference in New Issue
Block a user