Эх сурвалжийг харах

Make thermal zone configurable

Thomas Dy 9 жил өмнө
parent
commit
c1ac5ed2a7
1 өөрчлөгдсөн 5 нэмэгдсэн , 2 устгасан
  1. 5 2
      src/sensors.rs

+ 5 - 2
src/sensors.rs

@@ -69,9 +69,12 @@ impl Sensor for TimeSensor {
     }
 }
 
-pub fn sensors(tx: &Channel, _config: &Config) {
+pub fn sensors(tx: &Channel, config: &Config) {
+    let zone = config.lookup("sensors.thermal_zone").unwrap();
+    let zone = zone.as_str().unwrap();
+
     let mut sensors: Vec<Box<Sensor>> = vec![
-        Box::new(TempSensor::new("thermal_zone0")),
+        Box::new(TempSensor::new(zone)),
         Box::new(TimeSensor::new("%Y-%m-%d %H:%M", false)),
         Box::new(TimeSensor::new("UTC %H:%M", true))
     ];