|
@@ -9,6 +9,7 @@ use comm;
|
|
|
use comm::Channel;
|
|
|
use config::Config;
|
|
|
use std::thread;
|
|
|
+use std::time::Duration;
|
|
|
use self::battery::BatterySensor;
|
|
|
use self::tp_battery::TPBatterySensor;
|
|
|
use self::disk::DiskSensor;
|
|
@@ -49,6 +50,7 @@ pub fn sensors(tx: &Channel, config: &Config) {
|
|
|
});
|
|
|
tp_bat.map(|bats| sensors.insert(1, Box::new(TPBatterySensor::new(&bats))));
|
|
|
|
|
|
+ let delay = Duration::from_secs(1);
|
|
|
loop {
|
|
|
let status = sensors.iter_mut()
|
|
|
.map(|sensor| {
|
|
@@ -62,7 +64,7 @@ pub fn sensors(tx: &Channel, config: &Config) {
|
|
|
.collect::<Vec<String>>();
|
|
|
|
|
|
comm::send(tx, "sensors", &reduce(status));
|
|
|
- thread::sleep_ms(1000);
|
|
|
+ thread::sleep(delay);
|
|
|
}
|
|
|
}
|
|
|
|