mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: adjusted CPU and GPU sensors for m2 apple silicon (#1286)
This commit is contained in:
@@ -118,7 +118,13 @@ internal class SensorsReader: Reader<Sensors_List> {
|
||||
for i in self.list.sensors.indices {
|
||||
guard self.list.sensors[i].group != .hid && !self.list.sensors[i].isComputed else { continue }
|
||||
if !self.unknownSensorsState && self.list.sensors[i].group == .unknown { continue }
|
||||
self.list.sensors[i].value = SMC.shared.getValue(self.list.sensors[i].key) ?? 0
|
||||
|
||||
var newValue = SMC.shared.getValue(self.list.sensors[i].key) ?? 0
|
||||
if self.list.sensors[i].type == .temperature && self.list.sensors[i].group == .CPU &&
|
||||
(newValue < 10 || newValue > 120) { // fix for m2 broken sensors
|
||||
newValue = self.list.sensors[i].value
|
||||
}
|
||||
self.list.sensors[i].value = newValue
|
||||
}
|
||||
|
||||
var cpuSensors = self.list.sensors.filter({ $0.group == .CPU && $0.type == .temperature && $0.average }).map{ $0.value }
|
||||
|
||||
@@ -357,18 +357,17 @@ internal let SensorsList: [Sensor] = [
|
||||
Sensor(key: "Tg0T", name: "GPU 4", group: .GPU, type: .temperature, platforms: [.m1, .m1Pro, .m1Max, .m1Ultra], average: true),
|
||||
|
||||
// M2
|
||||
Sensor(key: "Tp05", name: "CPU efficiency core 1", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0D", name: "CPU efficiency core 2", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0j", name: "CPU efficiency core 3", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0r", name: "CPU efficiency core 4", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
|
||||
Sensor(key: "Tp01", name: "CPU performance core 1", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp09", name: "CPU performance core 2", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0f", name: "CPU performance core 3", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0n", name: "CPU performance core 4", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0A", name: "CPU core 1", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0D", name: "CPU core 2", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp0E", name: "CPU core 3", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp01", name: "CPU core 4", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp02", name: "CPU core 5", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp05", name: "CPU core 6", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp06", name: "CPU core 7", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tp09", name: "CPU core 8", group: .CPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
|
||||
Sensor(key: "Tg0f", name: "GPU 1", group: .GPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tg0n", name: "GPU 2", group: .GPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
Sensor(key: "Tg0j", name: "GPU 2", group: .GPU, type: .temperature, platforms: [.m2, .m2Max, .m2Pro, .m2Ultra], average: true),
|
||||
|
||||
Sensor(key: "TaLP", name: "Airflow left", group: .sensor, type: .temperature, platforms: Platform.apple),
|
||||
Sensor(key: "TaRF", name: "Airflow right", group: .sensor, type: .temperature, platforms: Platform.apple),
|
||||
|
||||
Reference in New Issue
Block a user