forked from ROMEO/nexosim
Overload schedule_*event
methods
The `schedule_*event_in` and `schedule_*event_at` pairs of methods are each merged into a single overloaded method accepting either a relative `Duration`or an absolute `MonotonicTime`.
This commit is contained in:
@ -141,7 +141,7 @@ impl Controller {
|
||||
// Schedule the `stop_brew()` method and turn on the pump.
|
||||
self.stop_brew_key = Some(
|
||||
scheduler
|
||||
.schedule_keyed_event_in(self.brew_time, Self::stop_brew, ())
|
||||
.schedule_keyed_event(self.brew_time, Self::stop_brew, ())
|
||||
.unwrap(),
|
||||
);
|
||||
self.pump_cmd.send(PumpCommand::On).await;
|
||||
@ -274,7 +274,7 @@ impl Tank {
|
||||
let duration_until_empty = Duration::from_secs_f64(duration_until_empty);
|
||||
|
||||
// Schedule the next update.
|
||||
match scheduler.schedule_keyed_event_in(duration_until_empty, Self::set_empty, ()) {
|
||||
match scheduler.schedule_keyed_event(duration_until_empty, Self::set_empty, ()) {
|
||||
Ok(set_empty_key) => {
|
||||
let state = TankDynamicState {
|
||||
last_volume_update: time,
|
||||
@ -431,7 +431,7 @@ fn main() {
|
||||
assert_eq!(flow_rate.take(), Some(0.0));
|
||||
|
||||
// Interrupt the brew after 15s by pressing again the brew button.
|
||||
simu.schedule_event_in(
|
||||
simu.schedule_event(
|
||||
Duration::from_secs(15),
|
||||
Controller::brew_cmd,
|
||||
(),
|
||||
|
@ -174,7 +174,7 @@ impl Driver {
|
||||
|
||||
// Schedule the next pulse.
|
||||
scheduler
|
||||
.schedule_event_in(pulse_duration, Self::send_pulse, ())
|
||||
.schedule_event(pulse_duration, Self::send_pulse, ())
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ fn main() {
|
||||
assert!(position.next().is_none());
|
||||
|
||||
// Start the motor in 2s with a PPS of 10Hz.
|
||||
simu.schedule_event_in(
|
||||
simu.schedule_event(
|
||||
Duration::from_secs(2),
|
||||
Driver::pulse_rate,
|
||||
10.0,
|
||||
|
Reference in New Issue
Block a user