forked from ROMEO/obsw
two tasks running
This commit is contained in:
parent
5bb01f1731
commit
f02e847ef1
@ -318,33 +318,33 @@ fn mission() {
|
||||
id: 1,
|
||||
//command_queue: MessageQueue::new(),
|
||||
};
|
||||
// let mut h2 = HandlerSender {
|
||||
// id: 2,
|
||||
let mut h2 = Handler {
|
||||
id: 2,
|
||||
// cycle: 0,
|
||||
// other_handler: MessageQueueSender::<Message>::new(),
|
||||
// };
|
||||
};
|
||||
|
||||
// h2.other_handler = h1.command_queue.get_sender();
|
||||
|
||||
let t1: PeriodicTask = PeriodicTask::new(&mut h1, 512, 200);
|
||||
|
||||
let mut tasks = [t1];
|
||||
let t2: PeriodicTask = PeriodicTask::new(&mut h2, 512, 300);
|
||||
|
||||
let task_ref = &mut tasks[..];
|
||||
|
||||
let task1_ref = &task_ref[0];
|
||||
|
||||
sifln!("main t1 {:p}", task1_ref);
|
||||
|
||||
//let _t2: PeriodicTask<'_, 512> = PeriodicTask::new(&mut h2);
|
||||
|
||||
let mut task_executor = TaskExecutor{tasks: task_ref};
|
||||
let mut task_executor = TaskExecutor{tasks: &mut [t1,t2]};
|
||||
|
||||
task_executor.run_tasks();
|
||||
|
||||
sifln!("Mission delay");
|
||||
unsafe {
|
||||
task_delay(3000);
|
||||
task_delay(2000);
|
||||
}
|
||||
sifln!("Mission delay2");
|
||||
drop(task_executor);
|
||||
//t2.period = 100; //Invalid
|
||||
h1.id = 2;
|
||||
unsafe {
|
||||
task_delay(2000);
|
||||
}
|
||||
sifln!("Mission delay done");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user