diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 336faeff..89456d3a 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -15,7 +15,7 @@ AnyCPU False True - 0.113 + 0.114 diff --git a/app/Gpu/GPUModeControl.cs b/app/Gpu/GPUModeControl.cs index 4e3b4cd4..e96b58e3 100644 --- a/app/Gpu/GPUModeControl.cs +++ b/app/Gpu/GPUModeControl.cs @@ -11,6 +11,8 @@ namespace GHelper.Gpu ScreenControl screenControl = new ScreenControl(); public static int gpuMode; + public static bool? gpuExists = null; + public GPUModeControl(SettingsForm settingsForm) { @@ -38,8 +40,15 @@ namespace GHelper.Gpu // Ultimate mode not supported if (mux != 1) settings.HideUltimateMode(); + // GPU mode not supported - if (eco < 0 && mux < 0) settings.HideGPUModes(); + if (eco < 0 && mux < 0) + { + if (gpuExists is null) + gpuExists = HardwareControl.FormatFan(Program.acpi.DeviceGet(AsusACPI.GPU_Fan)) is not null; + + settings.HideGPUModes((bool)gpuExists); + } } AppConfig.Set("gpu_mode", gpuMode); diff --git a/app/HardwareControl.cs b/app/HardwareControl.cs index f513319a..0d89898b 100644 --- a/app/HardwareControl.cs +++ b/app/HardwareControl.cs @@ -83,7 +83,7 @@ public static class HardwareControl if (fan < 0) { fan += 65536; - if (fan < 0 || fan > 100) return null; //nothing reasonable + if (fan <= 0 || fan > 100) return null; //nothing reasonable } if (fan > fanMax && fan <= INADEQUATE_MAX) fanMax = fan; diff --git a/app/Settings.cs b/app/Settings.cs index 288aa8be..2720e678 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -996,7 +996,7 @@ namespace GHelper menuUltimate.Visible = false; } - public void HideGPUModes() + public void HideGPUModes(bool gpuExists) { isGpuSection = false; @@ -1009,10 +1009,7 @@ namespace GHelper SetContextMenu(); - var gpuFan = Program.acpi.DeviceGet(AsusACPI.GPU_Fan); - Logger.WriteLine("GPU check:" + gpuFan); - - if (HardwareControl.FormatFan(gpuFan) is null) panelGPU.Visible = false; + panelGPU.Visible = gpuExists; }