fix auto detect fan mode & support MacbookPro16,1 model

This commit is contained in:
Jeff Le
2020-07-18 16:25:46 +07:00
parent 065dc3bdcd
commit 78b25bc3d4
5 changed files with 58 additions and 13 deletions

View File

@ -540,8 +540,12 @@ NSUserDefaults *defaults;
[FanControl setRights];
[FavoritesController setSelectionIndex:cIndex];
if ([[MachineDefaults computerModel] rangeOfString:@"MacBookPro15"].location != NSNotFound) {
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
int fan_mode = [smcWrapper get_mode:i];
// Auto/forced mode is not available
if (fan_mode < 0) {
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMn",i] value:[[FanController arrangedObjects][i][PREF_FAN_SELSPEED] tohex]];
} else {
bool is_auto = [[FanController arrangedObjects][i][PREF_FAN_AUTO] boolValue];
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMd",i] value:is_auto ? @"00" : @"01"];
float f_val = [[FanController arrangedObjects][i][PREF_FAN_SELSPEED] floatValue];
@ -550,11 +554,6 @@ NSUserDefaults *defaults;
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dTg",i] value:[NSString stringWithFormat:@"%02x%02x%02x%02x",vals[0],vals[1],vals[2],vals[3]]];
}
}
else {
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMn",i] value:[[FanController arrangedObjects][i][PREF_FAN_SELSPEED] tohex]];
}
}
NSMenu *submenu = [[NSMenu alloc] init];