Fix for possible fan issues on old laptops

This commit is contained in:
seerge
2023-03-31 20:05:14 +02:00
parent 253e1eb095
commit bd207113f8
5 changed files with 15 additions and 4 deletions

View File

@@ -213,6 +213,11 @@ public class ASUSWmi
int result;
for (int i = 8; i < curve.Length; i++)
{
curve[i] = Math.Max((byte)0, Math.Min((byte)99, curve[i])); // it seems to be a bug, when some old model's bios can go nuts if fan is set to 100%
}
switch (device)
{
case 1:

View File

@@ -137,7 +137,7 @@ namespace GHelper
public static bool HasSecondColor()
{
return mode == 1;
return (mode == 1 && !Program.config.ContainsModel("TUF"));
}
public static int Speed

View File

@@ -16,7 +16,7 @@
<PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.44</AssemblyVersion>
<AssemblyVersion>0.45</AssemblyVersion>
</PropertyGroup>
<ItemGroup>

View File

@@ -47,13 +47,14 @@ public static class HardwareMonitor
public static void ReadSensors()
{
batteryDischarge = -1;
gpuTemp = -1;
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
midFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.Mid_Fan));
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
if (cpuTemp < 0) try
{
@@ -72,11 +73,15 @@ public static class HardwareMonitor
}
catch (Exception ex) {
gpuTemp = null;
gpuTemp = -1;
Logger.WriteLine("Failed reading GPU temp");
Logger.WriteLine(ex.ToString());
}
if (gpuTemp < 0)
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
try
{
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);

View File

@@ -56,6 +56,7 @@ namespace GHelper
}
Logger.WriteLine("------------");
Logger.WriteLine("App launched");
Application.EnableVisualStyles();