Mercurial > templog
annotate rust/src/fridge.rs @ 633:490e9e15b98c rust
move some bits to riker
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 04 Sep 2019 23:24:13 +0800 |
parents | bde302def78e |
children | a5721c02d3ee |
rev | line source |
---|---|
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
1 use std; |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
2 |
597 | 3 use std::time::{Duration,Instant}; |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
4 use riker::actors::*; |
621 | 5 |
6 #[cfg(target_os = "linux")] | |
626 | 7 use self::sysfs_gpio::{Direction, Pin}; |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
8 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
9 use super::config::Config; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
10 use super::params::Params; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
11 use super::types::*; |
592 | 12 |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
13 #[derive(Debug)] |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
14 pub struct Tick; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
15 |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
16 |
633 | 17 #[actor(Params, Tick, Readings)] |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
18 pub struct Fridge { |
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
19 params: Params, |
603
b45b8b4cf0f5
get rid of lazy_static, config is passed around
Matt Johnston <matt@ucc.asn.au>
parents:
601
diff
changeset
|
20 config: Config, |
620 | 21 |
22 on: bool, | |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
23 temp_wort: Option<f32>, |
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
24 temp_fridge: Option<f32>, |
620 | 25 last_off_time: Instant, |
26 wort_valid_time: Instant, | |
27 integrator: StepIntegrator, | |
621 | 28 control: FridgeControl, |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
29 } |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
30 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
31 impl Actor for Fridge { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
32 type Msg = FridgeMsg; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
33 fn recv(&mut self, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
34 ctx: &Context<Self::Msg>, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
35 msg: Self::Msg, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
36 sender: Sender) { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
37 self.receive(ctx, msg, sender); |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
38 // TODO: should we do self.tick(ctx) here instead? |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
39 } |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
40 |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
41 fn post_start(&mut self, ctx: &Context<Self::Msg>) { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
42 self.tick(ctx); |
633 | 43 |
44 let chan = channel("readings", &ctx.system).unwrap(); | |
45 let sub = Box::new(ctx.myself()); | |
46 chan.tell(Subscribe {actor: sub, topic: "readings".into()}, None); | |
47 | |
48 let chan = channel("params", &ctx.system).unwrap(); | |
49 let sub = Box::new(ctx.myself()); | |
50 chan.tell(Subscribe {actor: sub, topic: "params".into()}, None); | |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
51 } |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
52 } |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
53 |
633 | 54 impl Receive<Readings> for Fridge { |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
55 type Msg = FridgeMsg; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
56 fn receive(&mut self, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
57 ctx: &Context<Self::Msg>, |
633 | 58 r: Readings, |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
59 _sender: Sender) { |
633 | 60 self.temp_wort = r.get_temp(self.config.WORT_NAME); |
61 self.temp_fridge = r.get_temp(self.config.FRIDGE_NAME); | |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
62 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
63 if self.temp_wort.is_some() { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
64 self.wort_valid_time = Instant::now(); |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
65 } |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
66 |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
67 self.tick(ctx); |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
68 } |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
69 } |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
70 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
71 impl Receive<Params> for Fridge { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
72 type Msg = FridgeMsg; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
73 fn receive(&mut self, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
74 ctx: &Context<Self::Msg>, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
75 p: Params, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
76 _sender: Sender) { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
77 self.params = p; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
78 println!("fridge set_params {:?}", self.params); |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
79 |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
80 self.tick(ctx); |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
81 } |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
82 } |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
83 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
84 impl Receive<Tick> for Fridge { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
85 type Msg = FridgeMsg; |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
86 fn receive(&mut self, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
87 ctx: &Context<Self::Msg>, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
88 _tick: Tick, |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
89 _sender: Sender) { |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
90 self.tick(ctx); |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
91 } |
592 | 92 } |
93 | |
621 | 94 enum FridgeControl { |
95 #[cfg(target_os = "linux")] | |
96 Gpio(Pin), | |
97 Fake, | |
98 } | |
99 | |
620 | 100 impl Drop for Fridge { |
101 fn drop(&mut self) { | |
102 // safety fridge off | |
621 | 103 self.turn(false); |
620 | 104 } |
105 } | |
106 | |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
107 impl Fridge { |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
108 pub fn new(config: &Config, nowait: bool, p: Params) -> Fridge { |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
109 let mut f = Fridge { |
603
b45b8b4cf0f5
get rid of lazy_static, config is passed around
Matt Johnston <matt@ucc.asn.au>
parents:
601
diff
changeset
|
110 config: config.clone(), |
615 | 111 params: p.clone(), |
620 | 112 on: false, |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
113 temp_wort: None, |
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
114 temp_fridge: None, |
620 | 115 last_off_time: Instant::now(), |
116 wort_valid_time: Instant::now() - Duration::new(config.FRIDGE_WORT_INVALID_TIME, 100), | |
621 | 117 integrator: StepIntegrator::new(Duration::new(p.overshoot_delay, 0)), |
118 control: Self::make_control(config), | |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
119 }; |
620 | 120 |
597 | 121 if nowait { |
609
7bda01659426
not building, paramwaiter work
Matt Johnston <matt@ucc.asn.au>
parents:
606
diff
changeset
|
122 f.last_off_time -= Duration::new(config.FRIDGE_DELAY, 1); |
597 | 123 } |
620 | 124 |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
125 f.tick(); |
620 | 126 |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
127 f |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
128 } |
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
129 |
621 | 130 #[cfg(target_os = "linux")] |
131 fn make_control(config: &Config) -> FridgeControl { | |
132 let mut pin = Pin(config.FRIDGE_GPIO_PIN); | |
133 // XXX better error handling? | |
134 pin.export().expect("Exporting fridge gpio failed"); | |
135 pin.set_direction(Direction::Low).expect("Fridge gpio direction failed"); | |
136 FridgeControl::Gpio(pin) | |
137 } | |
138 | |
139 #[cfg(not(target_os = "linux"))] | |
140 fn make_control(config: &Config) -> FridgeControl { | |
141 FridgeControl::Fake | |
142 } | |
143 | |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
144 fn next_wakeup(&self) -> Duration { |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
145 let millis = 400; |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
146 let dur = Duration::from_millis(millis); |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
147 dur |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
148 } |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
149 |
606 | 150 |
620 | 151 fn turn_off(&mut self) { |
621 | 152 info!("Turning fridge off"); |
620 | 153 self.turn(false); |
154 } | |
155 | |
156 fn turn_on(&mut self) { | |
621 | 157 info!("Turning fridge on"); |
620 | 158 self.turn(true); |
159 } | |
160 | |
161 fn turn(&mut self, on: bool) { | |
621 | 162 match self.control { |
163 #[cfg(target_os = "linux")] | |
164 Gpio(pin) => pin.set_value(on as u8), | |
165 FridgeControl::Fake => debug!("fridge turns {}", if on {"on"} else {"off"}), | |
166 } | |
620 | 167 self.on = on; |
168 } | |
169 | |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
170 // Turns the fridge off and on |
620 | 171 fn compare_temperatures(&mut self) { |
172 let fridge_min = self.params.fridge_setpoint - self.params.fridge_range_lower; | |
173 let fridge_max = self.params.fridge_setpoint - self.params.fridge_range_upper; | |
174 let wort_max = self.params.fridge_setpoint + self.params.fridge_difference; | |
175 let off_time = Instant::now() - self.last_off_time; | |
176 | |
177 // Or elsewhere? | |
621 | 178 self.integrator.set_limit(Duration::new(self.params.overshoot_delay, 0)); |
620 | 179 |
180 // Safety to avoid bad things happening to the fridge motor (?) | |
181 // When it turns off don't start up again for at least FRIDGE_DELAY | |
621 | 182 if !self.on && off_time < Duration::new(self.config.FRIDGE_DELAY, 0) { |
183 info!("fridge skipping, too early"); | |
620 | 184 return; |
185 } | |
186 | |
187 if self.params.disabled { | |
188 if self.on { | |
621 | 189 info!("Disabled, turning fridge off"); |
620 | 190 self.turn_off(); |
191 } | |
192 return; | |
193 } | |
194 | |
195 // handle broken wort sensor | |
196 if self.temp_wort.is_none() { | |
197 let invalid_time = Instant::now() - self.wort_valid_time; | |
198 warn!("Invalid wort sensor for {:?} secs", invalid_time); | |
621 | 199 if invalid_time < Duration::new(self.config.FRIDGE_WORT_INVALID_TIME, 0) { |
620 | 200 warn!("Has only been invalid for {:?}, waiting", invalid_time); |
201 return; | |
202 } | |
203 } | |
204 | |
205 if self.temp_fridge.is_none() { | |
206 warn!("Invalid fridge sensor"); | |
207 } | |
208 | |
209 if self.on { | |
210 debug!("fridge is on"); | |
211 let on_time = self.integrator.integrate().as_secs() as f32; | |
621 | 212 let on_ratio = on_time / self.params.overshoot_delay as f32; |
620 | 213 |
621 | 214 let overshoot = self.params.overshoot_factor as f32 * on_ratio; |
215 debug!("on_percent {}, overshoot {}", on_ratio * 100.0, overshoot); | |
620 | 216 |
217 let mut turn_off = false; | |
621 | 218 if self.temp_wort.is_some() && !self.params.nowort { |
219 let t = self.temp_wort.unwrap(); | |
620 | 220 // use the wort temperature |
621 | 221 if t - overshoot < self.params.fridge_setpoint { |
222 info!("wort has cooled enough, {temp}º (overshoot {overshoot}º = {factor} × {percent}%)", | |
620 | 223 temp = t, overshoot = overshoot, |
621 | 224 factor = self.params.overshoot_factor, |
225 percent = on_ratio*100.0); | |
620 | 226 turn_off = true; |
227 } | |
621 | 228 } else if let Some(t) = self.temp_fridge { |
620 | 229 // use the fridge temperature |
230 if t < fridge_min { | |
231 warn!("fridge off fallback, fridge {}, min {}", t, fridge_min); | |
232 if self.temp_wort.is_none() { | |
621 | 233 warn!("wort has been invalid for {:?}", Instant::now() - self.wort_valid_time); |
620 | 234 } |
235 turn_off = true; | |
236 } | |
237 } | |
238 if turn_off { | |
239 self.turn_off(); | |
240 } | |
241 } else { | |
242 debug!("fridge is off. fridge {:?} max {:?}. wort {:?} max {:?}", | |
243 self.temp_fridge, fridge_max, self.temp_wort, wort_max); | |
244 let mut turn_on = false; | |
621 | 245 if self.temp_wort.is_some() && !self.params.nowort { |
620 | 246 // use the wort temperature |
621 | 247 let t = self.temp_wort.unwrap(); |
620 | 248 if t >= wort_max { |
621 | 249 info!("Wort is too hot {}°, max {}°", t, wort_max); |
620 | 250 turn_on = true; |
251 } | |
252 } | |
253 | |
254 if let Some(t) = self.temp_fridge { | |
255 if t >= fridge_max { | |
621 | 256 warn!("fridge too hot fallback, fridge {}°, max {}°", t, fridge_max); |
620 | 257 turn_on = true; |
258 } | |
259 } | |
260 | |
261 if turn_on { | |
262 self.turn_on() | |
263 } | |
264 } | |
265 } | |
266 | |
606 | 267 /// Must be called after every state change. Turns the fridge on/off as required and |
268 /// schedules any future wakeups based on the present (new) state | |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
269 /// Examples of wakeups events are |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
270 /// |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
271 /// * overshoot calculation |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
272 /// * minimum fridge-off time |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
273 /// * invalid wort timeout |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
274 /// All specified in next_wakeup() |
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
275 fn tick(&mut self, |
633 | 276 ctx: &Context<<Self as Actor>::Msg>) { |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
277 debug!("tick"); |
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
278 |
621 | 279 self.compare_temperatures(); |
592 | 280 |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
281 // Sets the next self-wakeup timeout |
594
aff50ee77252
rust working better now with streams and sinks.
Matt Johnston <matt@ucc.asn.au>
parents:
593
diff
changeset
|
282 let dur = self.next_wakeup(); |
632
bde302def78e
moving to riker, nowhere near yet
Matt Johnston <matt@ucc.asn.au>
parents:
631
diff
changeset
|
283 ctx.schedule_once(dur, self, None, Tick); |
593
bf138339d20a
fiddling with timeouts and closures
Matt Johnston <matt@ucc.asn.au>
parents:
592
diff
changeset
|
284 } |
592 | 285 } |