fix: fixed Apple Silicon sensors naming (#756)

This commit is contained in:
Serhiy Mytrovtsiy
2021-12-22 17:52:41 +01:00
parent 1c7314a379
commit f67aa5446c
2 changed files with 11 additions and 7 deletions

View File

@@ -195,13 +195,17 @@ internal class AppleSilicon_SensorsReader: SensorsReader {
var name: String = key
var g: SensorGroup = group
AppleSiliconSensorsList.filter{ $0.key.contains("%") }.forEach { (s: Sensor) in
var index = 1
for i in 0..<64 {
if s.key.replacingOccurrences(of: "%", with: "\(i)") == key {
name = s.name.replacingOccurrences(of: "%", with: "\(index)")
AppleSiliconSensorsList.forEach { (s: Sensor) in
if s.key.contains("%") {
var index = 1
for i in 0..<64 {
if s.key.replacingOccurrences(of: "%", with: "\(i)") == key {
name = s.name.replacingOccurrences(of: "%", with: "\(index)")
}
index += 1
}
index += 1
} else if s.key == key {
name = s.name
}
g = s.group
}

View File

@@ -239,6 +239,6 @@ let AppleSiliconSensorsList: [Sensor] = [
Sensor(key: "PMU tdev%", name: "Power management unit dev %", group: .sensor, type: .temperature),
Sensor(key: "PMU tdie%", name: "Power management unit die %", group: .sensor, type: .temperature),
Sensor(key: "Gas gauge battery", name: "Battery", group: .sensor, type: .temperature),
Sensor(key: "gas gauge battery", name: "Battery", group: .sensor, type: .temperature),
Sensor(key: "NAND CH% temp", name: "Disk %s", group: .GPU, type: .temperature)
]