For Apple Silicon use the temperature sensors from IOKIT

This commit is contained in:
Raafat Akkad
2022-12-02 23:34:35 +00:00
parent 71c252571f
commit 346eceb501
8 changed files with 150 additions and 22 deletions

View File

@ -70,11 +70,7 @@ NSArray *allSensors;
NSString *sensor = [[NSUserDefaults standardUserDefaults] objectForKey:PREF_TEMPERATURE_SENSOR];
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
retValue = [self convertToNumber:val];
if ([MachineDefaults isAppleSilicon]) {
allSensors = [NSArray arrayWithObjects:@"Tp0D",@"Tp0P",nil];
} else {
allSensors = [NSArray arrayWithObjects:@"TC0D",@"TC0P",@"TCAD",@"TC0H",@"TC0F",@"TCAH",@"TCBH",nil];
}
allSensors = [NSArray arrayWithObjects:@"TC0D",@"TC0P",@"TCAD",@"TC0H",@"TC0F",@"TCAH",@"TCBH",nil];
if (retValue<=0 || floor(retValue) == 129 ) { //workaround for some iMac Models
for (NSString *sensor in allSensors) {
SMCReadKey2((char*)[sensor UTF8String], &val,conn);