Compare commits
No commits in common. "6458087654c3140fd2c9667db75c72e7b1014bf2" and "f12dbbf2bc3611a6938f6762c14bb5c7fcee9d28" have entirely different histories.
6458087654
...
f12dbbf2bc
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -93,7 +93,7 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mtemp"
|
name = "mtemp"
|
||||||
version = "0.1.23"
|
version = "0.1.22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -3,7 +3,7 @@ name = "mtemp"
|
|||||||
description = "CLI for monitoring temperatures"
|
description = "CLI for monitoring temperatures"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Midefos <midefos@gmail.com>"]
|
authors = ["Midefos <midefos@gmail.com>"]
|
||||||
version = "0.1.23"
|
version = "0.1.22"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://git.midefos.com/midefos/temp/"
|
repository = "https://git.midefos.com/midefos/temp/"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -34,30 +34,28 @@ pub struct Sensor {
|
|||||||
#[serde(rename = "Adapter")]
|
#[serde(rename = "Adapter")]
|
||||||
_adapter: String,
|
_adapter: String,
|
||||||
|
|
||||||
#[serde(rename = "Tctl", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "Tctl")]
|
||||||
tctl: Option<BTreeMap<String, f64>>,
|
tctl: Option<BTreeMap<String, f64>>,
|
||||||
|
|
||||||
#[serde(rename = "Tccd1", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "Tccd1")]
|
||||||
tccd1: Option<BTreeMap<String, f64>>,
|
tccd1: Option<BTreeMap<String, f64>>,
|
||||||
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
temp1: Option<BTreeMap<String, f64>>,
|
temp1: Option<BTreeMap<String, f64>>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
temp2: Option<BTreeMap<String, f64>>,
|
|
||||||
|
|
||||||
#[serde(rename = "Package id 0", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "Composite")]
|
||||||
package_id_0: Option<BTreeMap<String, f64>>,
|
|
||||||
|
|
||||||
#[serde(rename = "Composite", skip_serializing_if = "Option::is_none")]
|
|
||||||
composite: Option<BTreeMap<String, f64>>,
|
composite: Option<BTreeMap<String, f64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sensor {
|
impl Sensor {
|
||||||
pub fn temp(&self) -> Option<f64> {
|
pub fn temp(&self) -> Option<f64> {
|
||||||
let temperatures = self.actual_sector()?;
|
let sensor = self.actual_sector();
|
||||||
for temp_name in TEMP_NAMES {
|
match sensor {
|
||||||
if let Some(temp) = temperatures.get(temp_name) {
|
None => return None,
|
||||||
return Some(*temp);
|
Some(temperatures) => {
|
||||||
|
for temp_name in TEMP_NAMES {
|
||||||
|
if let Some(temp) = temperatures.get(temp_name) {
|
||||||
|
return Some(*temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
@ -76,14 +74,6 @@ impl Sensor {
|
|||||||
return self.temp1.clone();
|
return self.temp1.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.temp2.is_some() {
|
|
||||||
return self.temp2.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.package_id_0.is_some() {
|
|
||||||
return self.package_id_0.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.composite.is_some() {
|
if self.composite.is_some() {
|
||||||
return self.composite.clone();
|
return self.composite.clone();
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,6 @@ fn print_gpu_temp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn debug() {
|
fn debug() {
|
||||||
println!("lm-sensors: {:#?}", sensors_data());
|
println!("lm-sensors: {:?}", sensors_data());
|
||||||
println!("nvidia-smi: {:#?}", temperature());
|
println!("nvidia-smi: {:?}", temperature());
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
pub const TEMP_NAMES: [&str; 1] = ["temp1_input"];
|
pub const TEMP_NAMES: [&str; 1] = ["temp1_input"];
|
||||||
|
pub const CPU_NAMES: [&str; 1] = ["k10temp-pci-00c3"];
|
||||||
pub const CPU_NAMES: [&str; 2] = ["k10temp-pci-00c3", "coretemp-isa-0000"];
|
pub const DISK_NAMES: [&str; 1] = ["nvme-pci-0100"];
|
||||||
pub const DISK_NAMES: [&str; 3] = ["nvme-pci-0100", "nvme-pci-0200", "nvme-pci-0300"];
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user