fix: fixed CPU and GPU sensors list filtering when initialization average sensors (#892)

feat: added updates for average and hottest SOC
This commit is contained in:
Serhiy Mytrovtsiy
2022-04-07 20:06:23 +02:00
parent ca8d601f89
commit 43a22909f5
2 changed files with 15 additions and 3 deletions

View File

@@ -118,6 +118,18 @@ internal class SensorsReader: Reader<[Sensor_p]> {
cpuSensors += self.list.filter({ $0.key.hasPrefix("pACC MTR Temp") || $0.key.hasPrefix("eACC MTR Temp") }).map{ $0.value }
gpuSensors += self.list.filter({ $0.key.hasPrefix("GPU MTR Temp") }).map{ $0.value }
let socSensors = list.filter({ $0.key.hasPrefix("SOC MTR Temp") }).map{ $0.value }
if !socSensors.isEmpty {
if let idx = self.list.firstIndex(where: { $0.key == "Average SOC" }) {
self.list[idx].value = socSensors.reduce(0, +) / Double(socSensors.count)
}
if let max = socSensors.max() {
if let idx = self.list.firstIndex(where: { $0.key == "Hottest SOC" }) {
self.list[idx].value = max
}
}
}
}
#endif
@@ -309,8 +321,8 @@ internal class SensorsReader: Reader<[Sensor_p]> {
#if arch(arm64)
if self.HIDState {
cpuSensors += list.filter({ $0.key.hasPrefix("pACC MTR Temp") || $0.key.hasPrefix("eACC MTR Temp") }).map{ $0.value }
gpuSensors += list.filter({ $0.key.hasPrefix("GPU MTR Temp") }).map{ $0.value }
cpuSensors += self.list.filter({ $0.key.hasPrefix("pACC MTR Temp") || $0.key.hasPrefix("eACC MTR Temp") }).map{ $0.value }
gpuSensors += self.list.filter({ $0.key.hasPrefix("GPU MTR Temp") }).map{ $0.value }
}
#endif

View File

@@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>354</string>
<string>355</string>
<key>Description</key>
<string>Simple macOS system monitor in your menu bar</string>
<key>LSApplicationCategoryType</key>