On Apple Silicon set the fan to Auto before sleeping. systemDidWakeFromSleep will set the previous selection on wake

This commit is contained in:
Raafat Akkad
2022-04-07 23:24:39 +01:00
parent 618c22ea89
commit 53b337f15f
6 changed files with 41 additions and 16 deletions

View File

@ -22,7 +22,6 @@
*/
#import "smcWrapper.h"
#include "TargetConditionals.h"
#import <CommonCrypto/CommonDigest.h>
NSString * const smc_checksum=@"4fc00a0979970ee8b55f078a0c793c4d";
@ -71,11 +70,11 @@ NSArray *allSensors;
NSString *sensor = [[NSUserDefaults standardUserDefaults] objectForKey:PREF_TEMPERATURE_SENSOR];
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
retValue = [self convertToNumber:val];
#if TARGET_CPU_ARM64
allSensors = [NSArray arrayWithObjects:@"Tp0D",@"Tp0P",nil];
#else
allSensors = [NSArray arrayWithObjects:@"TC0D",@"TC0P",@"TCAD",@"TC0H",@"TC0F",@"TCAH",@"TCBH",nil];
#endif
if ([MachineDefaults isAppleSilicon]) {
allSensors = [NSArray arrayWithObjects:@"Tp0D",@"Tp0P",nil];
} else {
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);