@@ -74,7 +74,6 @@ bool AsusDLL::set_fan_test_mode(char mode)
74
74
set_fan_idx (fanIdx);
75
75
FanTestMode set_fan_test_mode = (FanTestMode)GetProcAddress (asus_dll, " HealthyTable_SetFanTestMode" );
76
76
set_fan_test_mode (mode);
77
- Sleep (50 );
78
77
}
79
78
80
79
current_fan_test_mode = mode;
@@ -103,39 +102,23 @@ bool AsusDLL::set_fan_speed_idx(byte value, byte fanIdx = 0)
103
102
return success (_ts (L" Set fan speed #" ) + _ts (fanIdx) + _ts (L" to " ) + _ts (value), false );
104
103
}
105
104
106
- bool AsusDLL::set_fan_speed (int percent)
105
+ bool AsusDLL::set_fan_speed (float percent)
107
106
{
108
107
if (!init_status) return failed ();
109
108
110
109
// wont change if the delta is too small
111
110
if (abs (AsusDLL::current_fan_percent - percent) <= 1 ) return success ();
112
111
113
112
// set to 0 if the percent is too small
114
- if (percent < 20 ) percent = 0 ;
113
+ if (percent < 10 ) percent = 0 ;
115
114
116
- inipp::Ini<wchar_t > settings;
117
- read_settings (settings);
118
- int update_interval = 2000 ;
119
- inipp::extract (settings.sections [L" General" ][L" UpdateInterval" ], update_interval);
120
- settings.clear ();
121
-
122
- // soften the curve e.g. not change the speed too fast
123
- float delta = 5 .0f * update_interval / 1000 ; // not faster than 5% per second
124
-
125
- if (abs (AsusDLL::current_fan_percent - percent) >= delta) { // if the delta is big enough, change it
126
- if (AsusDLL::current_fan_percent < percent) AsusDLL::current_fan_percent += delta;
127
- else AsusDLL::current_fan_percent -= delta;
128
- }
129
- else { // if the delta is too small, just set it to the target
130
- AsusDLL::current_fan_percent = percent;
131
- }
115
+ AsusDLL::current_fan_percent = percent;
132
116
133
117
byte value = max ((byte)1 , (byte)(AsusDLL::current_fan_percent / 100 .0f * 255 ));
134
118
135
119
int fan_cnt = AsusDLL::get_fan_count ();
136
120
for (byte fanIdx = 0 ; fanIdx < fan_cnt; ++fanIdx) {
137
121
if (!AsusDLL::set_fan_speed_idx (value, fanIdx)) return failed ();
138
- Sleep (50 );
139
122
}
140
123
return success (_ts (L" Set fan speed to " ) + _ts (value), true );
141
124
}
@@ -177,7 +160,6 @@ std::vector<int> AsusDLL::get_fan_speed()
177
160
int val = AsusDLL::get_fan_speed_idx (fanIdx);
178
161
if (val == -1 ) break ;
179
162
fan_speed_list.push_back (val);
180
- Sleep (50 );
181
163
}
182
164
183
165
last_update_fan_speed = convert_to_ull (st);
@@ -200,7 +182,7 @@ ULONG AsusDLL::get_thermal()
200
182
TherGPU thermal_gpu = (TherGPU)GetProcAddress (asus_dll, " Thermal_Read_GpuTS1L_Temperature" );
201
183
current_cpu_thermal = thermal_cpu ();
202
184
current_gpu_thermal = thermal_gpu ();
203
- current_combined_thermal = max (current_cpu_thermal, current_gpu_thermal);
185
+ current_combined_thermal = max (current_cpu_thermal, current_gpu_thermal* 5 / 4 ); // GPU overheats faster than CPU, but not too much
204
186
last_update_thermal = convert_to_ull (st);
205
187
206
188
return current_combined_thermal;
0 commit comments