diff --git a/app/ASUSWmi.cs b/app/ASUSWmi.cs index cd10bb6b..bbe9eefa 100644 --- a/app/ASUSWmi.cs +++ b/app/ASUSWmi.cs @@ -60,7 +60,7 @@ public class ASUSWmi public const int GPUModeUltimate = 2; - public const int MaxTotal = 150; + public const int MaxTotal = 180; public const int MinTotal = 5; public const int DefaultTotal = 125; diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index d4665a40..7b426973 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -31,12 +31,12 @@ namespace GHelper /// private void InitializeComponent() { - ChartArea chartArea1 = new ChartArea(); - Title title1 = new Title(); - ChartArea chartArea2 = new ChartArea(); - Title title2 = new Title(); - ChartArea chartArea3 = new ChartArea(); - Title title3 = new Title(); + ChartArea chartArea4 = new ChartArea(); + Title title4 = new Title(); + ChartArea chartArea5 = new ChartArea(); + Title title5 = new Title(); + ChartArea chartArea6 = new ChartArea(); + Title title6 = new Title(); panelFans = new Panel(); labelTip = new Label(); labelBoost = new Label(); @@ -161,8 +161,8 @@ namespace GHelper // // chartGPU // - chartArea1.Name = "ChartArea1"; - chartGPU.ChartAreas.Add(chartArea1); + chartArea4.Name = "ChartArea1"; + chartGPU.ChartAreas.Add(chartArea4); chartGPU.Dock = DockStyle.Fill; chartGPU.Location = new Point(2, 340); chartGPU.Margin = new Padding(2, 10, 2, 10); @@ -170,13 +170,13 @@ namespace GHelper chartGPU.Size = new Size(760, 310); chartGPU.TabIndex = 17; chartGPU.Text = "chartGPU"; - title1.Name = "Title1"; - chartGPU.Titles.Add(title1); + title4.Name = "Title1"; + chartGPU.Titles.Add(title4); // // chartCPU // - chartArea2.Name = "ChartArea1"; - chartCPU.ChartAreas.Add(chartArea2); + chartArea5.Name = "ChartArea1"; + chartCPU.ChartAreas.Add(chartArea5); chartCPU.Dock = DockStyle.Fill; chartCPU.Location = new Point(2, 10); chartCPU.Margin = new Padding(2, 10, 2, 10); @@ -184,13 +184,13 @@ namespace GHelper chartCPU.Size = new Size(760, 310); chartCPU.TabIndex = 14; chartCPU.Text = "chartCPU"; - title2.Name = "Title1"; - chartCPU.Titles.Add(title2); + title5.Name = "Title1"; + chartCPU.Titles.Add(title5); // // chartMid // - chartArea3.Name = "ChartArea3"; - chartMid.ChartAreas.Add(chartArea3); + chartArea6.Name = "ChartArea3"; + chartMid.ChartAreas.Add(chartArea6); chartMid.Dock = DockStyle.Fill; chartMid.Location = new Point(2, 670); chartMid.Margin = new Padding(2, 10, 2, 10); @@ -198,8 +198,8 @@ namespace GHelper chartMid.Size = new Size(760, 312); chartMid.TabIndex = 14; chartMid.Text = "chartMid"; - title3.Name = "Title3"; - chartMid.Titles.Add(title3); + title6.Name = "Title3"; + chartMid.Titles.Add(title6); chartMid.Visible = false; // // labelFans @@ -336,7 +336,7 @@ namespace GHelper trackCPU.Location = new Point(48, 88); trackCPU.Margin = new Padding(4, 2, 4, 2); trackCPU.Maximum = 85; - trackCPU.Minimum = 15; + trackCPU.Minimum = 5; trackCPU.Name = "trackCPU"; trackCPU.Orientation = Orientation.Vertical; trackCPU.Size = new Size(90, 416); @@ -381,8 +381,8 @@ namespace GHelper // trackTotal.Location = new Point(44, 88); trackTotal.Margin = new Padding(4, 2, 4, 2); - trackTotal.Maximum = 150; - trackTotal.Minimum = 15; + trackTotal.Maximum = 180; + trackTotal.Minimum = 10; trackTotal.Name = "trackTotal"; trackTotal.Orientation = Orientation.Vertical; trackTotal.Size = new Size(90, 416); diff --git a/app/Fans.cs b/app/Fans.cs index 72e6638a..047a354a 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -108,7 +108,7 @@ namespace GHelper chart.ChartAreas[0].AxisY.Maximum = 100; chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F); - + chart.ChartAreas[0].AxisX.MajorGrid.LineColor = chartGrid; chart.ChartAreas[0].AxisY.MajorGrid.LineColor = chartGrid; chart.ChartAreas[0].AxisX.LineColor = chartGrid; diff --git a/app/HardwareMonitor.cs b/app/HardwareMonitor.cs index f70a6ab7..9381734b 100644 --- a/app/HardwareMonitor.cs +++ b/app/HardwareMonitor.cs @@ -1,7 +1,6 @@ -using System.Diagnostics; -using GHelper; +using GHelper; using GHelper.Gpu; -using NvAPIWrapper.GPU; +using System.Diagnostics; public static class HardwareMonitor { @@ -45,7 +44,7 @@ public static class HardwareMonitor if (Program.config.getConfig("fan_rpm") == 1) return " Fan: " + (fan * 100).ToString() + "RPM"; else - return " Fan: " + Math.Min(Math.Round((float)fan/fanMax*100), 100).ToString() + "%"; // relatively to 6000 rpm + return " Fan: " + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm } private static int GetGpuUse() @@ -80,27 +79,29 @@ public static class HardwareMonitor var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true); cpuTemp = ct.NextValue() - 273; ct.Dispose(); - } catch + } + catch { - Logger.WriteLine("Failed reading CPU temp"); + Debug.WriteLine("Failed reading CPU temp"); } try { - gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature(); + gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature(); } - catch (Exception ex) { + catch (Exception ex) + { gpuTemp = -1; - Logger.WriteLine("Failed reading GPU temp"); - Logger.WriteLine(ex.ToString()); + Debug.WriteLine("Failed reading GPU temp"); + Debug.WriteLine(ex.ToString()); } if (gpuTemp is null || gpuTemp < 0) gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU); gpuUsage.Add(GetGpuUse()); - if (gpuUsage.Count > 3) gpuUsage.RemoveAt(0); + if (gpuUsage.Count > 3) gpuUsage.RemoveAt(0); try { @@ -111,23 +112,25 @@ public static class HardwareMonitor } catch { - Logger.WriteLine("Failed reading Battery discharge"); + Debug.WriteLine("Failed reading Battery discharge"); } } public static bool IsUsedGPU(int threshold = 50) { - if (GetGpuUse() > threshold) + if (GetGpuUse() > threshold) return true; - else + else return (gpuUsage.Average() > threshold); } - public static void RecreateGpuTemperatureProviderWithDelay() { + public static void RecreateGpuTemperatureProviderWithDelay() + { // Re-enabling the discrete GPU takes a bit of time, // so a simple workaround is to refresh again after that happens - Task.Run(async () => { + Task.Run(async () => + { await Task.Delay(TimeSpan.FromSeconds(5)); RecreateGpuTemperatureProvider(); }); @@ -136,7 +139,8 @@ public static class HardwareMonitor } - public static void RecreateGpuTemperatureProvider() { + public static void RecreateGpuTemperatureProvider() + { try { GpuTemperatureProvider?.Dispose(); @@ -163,8 +167,8 @@ public static class HardwareMonitor GpuTemperatureProvider = null; } catch (Exception ex) - { + { Debug.WriteLine(ex.ToString()); - } + } } }