we require an asynchronix update here I guess
Rust/sat-rs/pipeline/head There was a failure building this commit Details

This commit is contained in:
Robin Müller 2024-03-12 18:25:21 +01:00
parent 128df9a813
commit f00e6cf50c
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 6 additions and 4 deletions

View File

@ -49,18 +49,18 @@ impl SimController {
}
pub fn run(&mut self, start_time: MonotonicTime, udp_polling_interval_ms: u64) {
let mut t = start_time + Duration::from_millis(udp_polling_interval_ms);
self.sys_clock.synchronize(t);
let mut t = start_time;
loop {
let t_old = t;
// Check for UDP requests every millisecond. Shift the simulator ahead here to prevent
// replies lying in the past.
t += Duration::from_millis(udp_polling_interval_ms);
self.sys_clock.synchronize(t);
self.handle_sim_requests();
self.simulation
.step_until(t)
.expect("simulation step failed");
self.handle_sim_requests();
self.sys_clock.synchronize(t);
}
}

View File

@ -1,3 +1,4 @@
use asynchronix::time::MonotonicTime;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -19,6 +20,7 @@ pub struct SimMessage {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SimRequest {
inner: SimMessage,
timestamp: MonotonicTime
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]