X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=int%2Fmain.c;h=3388f2102e74e6ceb44b0ce0ee3d68283fb6ecc1;hb=9f47008270ad2ab66d7787eb29b0f83a82a8e42e;hp=b813ab2558c361016c1f014a4ecec256eeb67aba;hpb=b55c1c423b6f00357b2ae2bbdd2abcf4456fd0cd;p=mTask.git diff --git a/int/main.c b/int/main.c index b813ab2..3388f21 100644 --- a/int/main.c +++ b/int/main.c @@ -3,7 +3,8 @@ #include #include -#ifndef STM +#ifdef STM +#else #include #endif @@ -23,14 +24,15 @@ void read_message(void) //Find next task if(input_available()){ uint8_t c = read_byte(); - debug("Receiving input: %c\n", c); + uint8_t ct; + debug("Receiving input: %c %02x\n", c, c); switch(c){ case MSG_SDS_SPEC: debug("Receiving an sds"); sds_register(); break; case MSG_SDS_UPD: - debug("Receiving an sds"); + debug("Receiving an sds update"); //TODO do something with the return value sds_update(); break; @@ -40,9 +42,10 @@ void read_message(void) break; case MSG_GET_TASK: debug("Receiving a task"); - write_dpin(0, true); - task_register(); - write_dpin(0, false); + ct = task_register(); + write_byte('t'); + write16(ct); + write_byte('\n'); break; case '\0': break; @@ -78,6 +81,12 @@ void loop(void) debug("Current task to run: %d", ct); run_task(curtask); curtask->lastrun = cyclestart; + if(curtask->interval == 0){ + curtask->used = false; + write_byte('m'); + write_byte('d'); + write_byte('\n'); + } write_byte('\n'); } } @@ -94,13 +103,12 @@ int main(int argc, char *argv[]){ setup(); sds_init(); task_init(); - - debug("booting up"); + //debug("booting up"); while(true){ //Check for newetasks - debug("loop"); +// debug("loop"); loop(); - delay(100); + delay(50); } return 0; }