comparison rust/src/fridge.rs @ 609:7bda01659426 rust

not building, paramwaiter work
author Matt Johnston <matt@ucc.asn.au>
date Sat, 18 Feb 2017 00:21:10 +0800
parents 3c1d37d78415
children f3e39e2107fd
comparison
equal deleted inserted replaced
608:71f045231a07 609:7bda01659426
66 ticker: 0, 66 ticker: 0,
67 last_off_time: Instant::now(), 67 last_off_time: Instant::now(),
68 wort_valid_time: Instant::now() - Duration::new(config.FRIDGE_WORT_INVALID_TIME, 100), 68 wort_valid_time: Instant::now() - Duration::new(config.FRIDGE_WORT_INVALID_TIME, 100),
69 }; 69 };
70 if nowait { 70 if nowait {
71 f.last_off_time -= Duration::new(config.FRIDGE_DELAY, 100); 71 f.last_off_time -= Duration::new(config.FRIDGE_DELAY, 1);
72 } 72 }
73 f.tick(); 73 f.tick();
74 f 74 f
75 } 75 }
76 76
123 }) 123 })
124 .map(|_| ()); 124 .map(|_| ());
125 self.handle.spawn(t); 125 self.handle.spawn(t);
126 } 126 }
127 127
128 fn process_msg(&mut self, msg: Message) 128 fn process_msg(&mut self, msg: Message) {
129 -> Box<Future<Item=(), Error=()>> {
130 debug!("process_msg {:?}", msg); 129 debug!("process_msg {:?}", msg);
131 match msg { 130 match msg {
132 Message::Sensor{wort, fridge} => self.update_sensor(wort, fridge), 131 Message::Sensor{wort, fridge} => self.update_sensor(wort, fridge),
133 Message::Params(p) => self.update_params(p), 132 Message::Params(p) => self.update_params(p),
134 Message::Tick(v) => if v == self.ticker {self.tick()}, // schedule a timeout if there are none pending 133 Message::Tick(v) => if v == self.ticker {self.tick()}, // schedule a timeout if there are none pending
135 }; 134 };
136 future::ok::<(),()>(()).boxed()
137 } 135 }
138 136
139 pub fn update_params(&mut self, p: Params) { 137 pub fn update_params(&mut self, p: Params) {
140 self.params = p; 138 self.params = p;
141 println!("fridge set_params {:?}", self.params); 139 println!("fridge set_params {:?}", self.params);