repositories
/
mTask.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update device name instead of record
[mTask.git]
/
client
/
main.c
diff --git
a/client/main.c
b/client/main.c
index
f86beff
..
720fd1a
100644
(file)
--- a/
client/main.c
+++ b/
client/main.c
@@
-11,6
+11,7
@@
#include "interpret.h"
#include "mTaskSymbols.h"
#include "sds.h"
#include "interpret.h"
#include "mTaskSymbols.h"
#include "sds.h"
+#include "spec.h"
#include "task.h"
#include "interface.h"
#include "task.h"
#include "interface.h"
@@
-19,6
+20,7
@@
#define MSG_SDS_SPEC 's'
#define MSG_SDS_DEL 'a'
#define MSG_SDS_UPD 'u'
#define MSG_SDS_SPEC 's'
#define MSG_SDS_DEL 'a'
#define MSG_SDS_UPD 'u'
+#define MSG_SPEC 'c'
void read_message(void)
{
void read_message(void)
{
@@
-48,7
+50,12
@@
void read_message(void)
debug("Receiving a task");
task_register();
break;
debug("Receiving a task");
task_register();
break;
+ case MSG_SPEC:
+ debug("Receiving a spec request");
+ spec_send();
+ break;
case '\0':
case '\0':
+ debug("Server closed connection");
break;
case '\n':
break;
break;
case '\n':
break;
@@
-74,17
+81,19
@@
void loop(void)
// debug("Task %d not implemented\n", ct);
continue;
}
// debug("Task %d not implemented\n", ct);
continue;
}
- //Onshot task
- if(curtask->interval == 0){
- run_task(curtask);
- curtask->used = false;
- //Interrupt task
- } else if(curtask->interval & 32768){
+ //interrupt task
+ if(is_interrupt_task(curtask) && had_interrupt(curtask)){
debug("Interrupt task %d not implemented", ct);
debug("Interrupt task %d not implemented", ct);
- //Interval task, check if interval is passed
+ run_task(curtask);
+ //Interval task, and interval passed
} else if(cyclestart-curtask->lastrun > curtask->interval){
debug("Running interval task: %d", ct);
run_task(curtask);
} else if(cyclestart-curtask->lastrun > curtask->interval){
debug("Running interval task: %d", ct);
run_task(curtask);
+
+ //Oneshot task, thus disable
+ if(curtask->interval == 0){
+ curtask->used = false;
+ }
curtask->lastrun = cyclestart;
}
}
curtask->lastrun = cyclestart;
}
}
@@
-102,11
+111,11
@@
int main(int argc, char *argv[]){
setup();
sds_init();
task_init();
setup();
sds_init();
task_init();
- debug("
booting up
");
+ debug("
sending device spec
");
while(true){
//Check for newetasks
loop();
while(true){
//Check for newetasks
loop();
- delay(
5
0);
+ delay(
10
0);
}
return 0;
}
}
return 0;
}