void read_message()
{
//Find next task
- uint8_t c = read_byte();
- debug("Receiving input: %c\n", c);
- switch(c){
- case MSG_SDS_SPEC:
- debug("Receiving an sds\n");
- sds_register();
- break;
- case MSG_SDS_UPD:
- debug("Receiving an sds\n");
- //TODO do something with the return value
- sds_update();
- break;
- case MSG_DEL_TASK:
- debug("Receiving a delete task request\n");
- task_delete();
- break;
- case MSG_GET_TASK:
- debug("Receiving a task\n");
- c = task_register();
- break;
- case '\n':
- break;
- default:
- debug("Unknown message: %X\n", c);
+ if(input_available()){
+ //debug("Receiving input: %c\n", c);
+ switch(bt){
+ case MSG_SDS_SPEC:
+ debug("Receiving an sds");
+ sds_register();
+ break;
+ case MSG_SDS_UPD:
+ debug("Receiving an sds");
+ //TODO do something with the return value
+ sds_update();
+ break;
+ case MSG_DEL_TASK:
+ debug("Receiving a delete task request");
+ task_delete();
+ break;
+ case MSG_GET_TASK:
+ debug("Receiving a task");
+ task_register();
+ break;
+ case '\0':
+ break;
+ case '\n':
+ break;
+ default:
+ debug("Unknown message: %X", bt);
+ }
}
}
long cyclestart;
struct task *curtask;
- if(input_available())
- read_message();
+ read_message();
//Run tasks
cyclestart = millis();
// debug("Task %d not scheduled\n", ct);
continue;
}
- printf("Current task to run: %d\n", ct);
+ debug("Current task to run: %d", ct);
run_task(curtask);
curtask->lastrun = cyclestart;
+ write_byte('\n');
}
- write_byte('\n');
}
#ifdef STM32F767xx
+char s[128] = "";
int main1(void){
+ uint8_t bt;
+ HAL_UART_Receive(&huart3, &bt, 1, 100000);
#else
int main(int argc, char *argv[]){
gargc = argc;
gargv = argv;
#endif
+ debug("booting up");
+
//Initialize systems
setup();
sds_init();
while(true){
//Check for new tasks
+// debug("loop\r\n");
loop();
- delay(10);
+ delay(100);
}
return 0;
}