Compare commits

...

23 Commits

Author SHA1 Message Date
seerge
89d7930323 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-13 23:30:02 +01:00
seerge
e26d26b498 - 2023-03-13 23:28:58 +01:00
seerge
a6d0dde4b0 - 2023-03-13 23:28:58 +01:00
seerge
f68d53aaf4 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-13 23:28:58 +01:00
seerge
a2ea3d18fd UI Tweaks 2023-03-13 23:28:58 +01:00
seerge
f77fcc940f Merge pull request #82 from ZimM-LostPolygon/gpu-temperature
fix: improved GPU temperature reliability
2023-03-13 23:28:58 +01:00
seerge
dd4d85f254 Turbo boost dropdown 2023-03-13 23:28:57 +01:00
seerge
2afbde814f fix: improved GPU temperature reliability 2023-03-13 23:28:57 +01:00
seerge
b6b06a3802 UI tweaks 2023-03-13 23:28:57 +01:00
seerge
4d58945688 Minor fixes 2023-03-13 23:28:57 +01:00
seerge
9aaf0159e5 Merged GPU temp reader 2023-03-13 23:28:57 +01:00
seerge
3cbaf1eb52 Merge pull request #74 from ZimM-LostPolygon/gpu-temperature
feat: added GPU temperature indication.
2023-03-13 23:28:57 +01:00
seerge
c76fbeab37 New sleep/wake up detection 2023-03-13 23:28:56 +01:00
seerge
15d580bbe3 fix: fixed crash when launched in Eco mode 2023-03-13 23:28:56 +01:00
seerge
2ec64bf8b5 feat: added GPU temperature indication. Supports both NVIDIA and AMD discrete GPUs
feat: immediately update sensors when opening GHelper window
2023-03-13 23:28:56 +01:00
seerge
254be71e88 - 2023-03-13 23:21:06 +01:00
seerge
e9ec8f0e8f - 2023-03-13 23:14:28 +01:00
seerge
0ef44a0495 Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-13 23:07:31 +01:00
seerge
e725760b24 UI Tweaks 2023-03-13 23:07:28 +01:00
seerge
a83ab4884e Merge pull request #82 from ZimM-LostPolygon/gpu-temperature
fix: improved GPU temperature reliability
2023-03-13 23:07:12 +01:00
Serhii Yolkin
7bfd10c65d fix: improved GPU temperature reliability 2023-03-13 22:45:12 +01:00
seerge
67b541b145 Turbo boost dropdown 2023-03-13 21:46:11 +01:00
seerge
f1ae14652f UI tweaks 2023-03-13 21:20:46 +01:00
9 changed files with 112 additions and 79 deletions

57
Fans.Designer.cs generated
View File

@@ -31,11 +31,12 @@
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
panelFans = new Panel(); panelFans = new Panel();
labelBoost = new Label();
comboBoost = new ComboBox();
picturePerf = new PictureBox(); picturePerf = new PictureBox();
tableFanCharts = new TableLayoutPanel(); tableFanCharts = new TableLayoutPanel();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart(); chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart(); chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
checkBoost = new CheckBox();
labelFans = new Label(); labelFans = new Label();
checkAuto = new CheckBox(); checkAuto = new CheckBox();
buttonReset = new Button(); buttonReset = new Button();
@@ -72,9 +73,10 @@
// //
// panelFans // panelFans
// //
panelFans.Controls.Add(labelBoost);
panelFans.Controls.Add(comboBoost);
panelFans.Controls.Add(picturePerf); panelFans.Controls.Add(picturePerf);
panelFans.Controls.Add(tableFanCharts); panelFans.Controls.Add(tableFanCharts);
panelFans.Controls.Add(checkBoost);
panelFans.Controls.Add(labelFans); panelFans.Controls.Add(labelFans);
panelFans.Controls.Add(checkAuto); panelFans.Controls.Add(checkAuto);
panelFans.Controls.Add(buttonReset); panelFans.Controls.Add(buttonReset);
@@ -87,6 +89,26 @@
panelFans.Size = new Size(824, 1159); panelFans.Size = new Size(824, 1159);
panelFans.TabIndex = 12; panelFans.TabIndex = 12;
// //
// labelBoost
//
labelBoost.AutoSize = true;
labelBoost.Location = new Point(397, 19);
labelBoost.Name = "labelBoost";
labelBoost.Size = new Size(125, 32);
labelBoost.TabIndex = 39;
labelBoost.Text = "CPU Boost";
//
// comboBoost
//
comboBoost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoost.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoost.FormattingEnabled = true;
comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive" });
comboBoost.Location = new Point(526, 15);
comboBoost.Name = "comboBoost";
comboBoost.Size = new Size(266, 40);
comboBoost.TabIndex = 38;
//
// picturePerf // picturePerf
// //
picturePerf.BackgroundImage = Properties.Resources.icons8_fan_head_96; picturePerf.BackgroundImage = Properties.Resources.icons8_fan_head_96;
@@ -106,7 +128,7 @@
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableFanCharts.Controls.Add(chartGPU, 0, 1); tableFanCharts.Controls.Add(chartGPU, 0, 1);
tableFanCharts.Controls.Add(chartCPU, 0, 0); tableFanCharts.Controls.Add(chartCPU, 0, 0);
tableFanCharts.Location = new Point(28, 68); tableFanCharts.Location = new Point(28, 64);
tableFanCharts.Margin = new Padding(6); tableFanCharts.Margin = new Padding(6);
tableFanCharts.Name = "tableFanCharts"; tableFanCharts.Name = "tableFanCharts";
tableFanCharts.RowCount = 2; tableFanCharts.RowCount = 2;
@@ -114,7 +136,7 @@
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F)); tableFanCharts.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableFanCharts.Size = new Size(764, 988); tableFanCharts.Size = new Size(764, 992);
tableFanCharts.TabIndex = 36; tableFanCharts.TabIndex = 36;
// //
// chartGPU // chartGPU
@@ -122,10 +144,10 @@
chartArea1.Name = "ChartArea1"; chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea1); chartGPU.ChartAreas.Add(chartArea1);
chartGPU.Dock = DockStyle.Fill; chartGPU.Dock = DockStyle.Fill;
chartGPU.Location = new Point(2, 504); chartGPU.Location = new Point(2, 506);
chartGPU.Margin = new Padding(2, 10, 2, 10); chartGPU.Margin = new Padding(2, 10, 2, 10);
chartGPU.Name = "chartGPU"; chartGPU.Name = "chartGPU";
chartGPU.Size = new Size(760, 474); chartGPU.Size = new Size(760, 476);
chartGPU.TabIndex = 17; chartGPU.TabIndex = 17;
chartGPU.Text = "chart1"; chartGPU.Text = "chart1";
// //
@@ -137,22 +159,10 @@
chartCPU.Location = new Point(2, 10); chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10); chartCPU.Margin = new Padding(2, 10, 2, 10);
chartCPU.Name = "chartCPU"; chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(760, 474); chartCPU.Size = new Size(760, 476);
chartCPU.TabIndex = 14; chartCPU.TabIndex = 14;
chartCPU.Text = "chartCPU"; chartCPU.Text = "chartCPU";
// //
// checkBoost
//
checkBoost.AutoSize = true;
checkBoost.ForeColor = SystemColors.ControlText;
checkBoost.Location = new Point(475, 18);
checkBoost.Margin = new Padding(4, 2, 4, 2);
checkBoost.Name = "checkBoost";
checkBoost.Size = new Size(320, 36);
checkBoost.TabIndex = 35;
checkBoost.Text = "CPU Turbo Boost enabled";
checkBoost.UseVisualStyleBackColor = true;
//
// labelFans // labelFans
// //
labelFans.AutoSize = true; labelFans.AutoSize = true;
@@ -268,7 +278,7 @@
panelCPU.Controls.Add(labelCPU); panelCPU.Controls.Add(labelCPU);
panelCPU.Controls.Add(label2); panelCPU.Controls.Add(label2);
panelCPU.Controls.Add(trackCPU); panelCPU.Controls.Add(trackCPU);
panelCPU.Location = new Point(184, 90); panelCPU.Location = new Point(184, 93);
panelCPU.Margin = new Padding(4); panelCPU.Margin = new Padding(4);
panelCPU.Name = "panelCPU"; panelCPU.Name = "panelCPU";
panelCPU.Size = new Size(160, 510); panelCPU.Size = new Size(160, 510);
@@ -315,7 +325,7 @@
panelTotal.Controls.Add(labelTotal); panelTotal.Controls.Add(labelTotal);
panelTotal.Controls.Add(label1); panelTotal.Controls.Add(label1);
panelTotal.Controls.Add(trackTotal); panelTotal.Controls.Add(trackTotal);
panelTotal.Location = new Point(16, 90); panelTotal.Location = new Point(16, 93);
panelTotal.Margin = new Padding(4); panelTotal.Margin = new Padding(4);
panelTotal.Name = "panelTotal"; panelTotal.Name = "panelTotal";
panelTotal.Size = new Size(160, 512); panelTotal.Size = new Size(160, 512);
@@ -362,7 +372,7 @@
// //
labelApplied.AutoSize = true; labelApplied.AutoSize = true;
labelApplied.ForeColor = Color.Tomato; labelApplied.ForeColor = Color.Tomato;
labelApplied.Location = new Point(56, 48); labelApplied.Location = new Point(56, 54);
labelApplied.Margin = new Padding(4, 0, 4, 0); labelApplied.Margin = new Padding(4, 0, 4, 0);
labelApplied.Name = "labelApplied"; labelApplied.Name = "labelApplied";
labelApplied.Size = new Size(143, 32); labelApplied.Size = new Size(143, 32);
@@ -453,9 +463,10 @@
private TableLayoutPanel tableFanCharts; private TableLayoutPanel tableFanCharts;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU; private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU; private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
private CheckBox checkBoost;
private Label labelFans; private Label labelFans;
private PictureBox picturePerf; private PictureBox picturePerf;
private PictureBox pictureBox1; private PictureBox pictureBox1;
private ComboBox comboBoost;
private Label labelBoost;
} }
} }

18
Fans.cs
View File

@@ -115,7 +115,7 @@ namespace GHelper
InitPower(); InitPower();
InitBoost(); InitBoost();
checkBoost.Click += CheckBoost_Click; comboBoost.SelectedIndexChanged += ComboBoost_Changed;
Shown += Fans_Shown; Shown += Fans_Shown;
@@ -125,19 +125,15 @@ namespace GHelper
public void InitBoost() public void InitBoost()
{ {
int boost = NativeMethods.GetCPUBoost(); int boost = NativeMethods.GetCPUBoost();
checkBoost.Checked = (boost > 0); if (boost >= 0)
comboBoost.SelectedIndex = boost;
} }
private void CheckBoost_Click(object? sender, EventArgs e) private void ComboBoost_Changed(object? sender, EventArgs e)
{ {
if (sender is null) if (sender is null) return;
return; ComboBox cmb = (ComboBox)sender;
NativeMethods.SetCPUBoost(cmb.SelectedIndex);
CheckBox chk = (CheckBox)sender;
if (chk.Checked)
NativeMethods.SetCPUBoost(2);
else
NativeMethods.SetCPUBoost(0);
} }
private void CheckApplyPower_Click(object? sender, EventArgs e) private void CheckApplyPower_Click(object? sender, EventArgs e)

View File

@@ -19,14 +19,12 @@ public class NvidiaGpuTemperatureProvider : IGpuTemperatureProvider {
if (!IsValid) if (!IsValid)
return null; return null;
PhysicalGPU internalGpu = _internalGpu!;
IThermalSensor? gpuSensor = IThermalSensor? gpuSensor =
GPUApi.GetThermalSettings(_internalGpu!.Handle).Sensors GPUApi.GetThermalSettings(internalGpu.Handle).Sensors
.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU); .FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU);
if (gpuSensor == null) return gpuSensor?.CurrentTemperature;
return null;
return gpuSensor.CurrentTemperature;
} }
public void Dispose() { public void Dispose() {

View File

@@ -1,7 +1,7 @@
using System.Diagnostics; using System.Diagnostics;
using GHelper.Gpu; using GHelper.Gpu;
public class HardwareMonitor public static class HardwareMonitor
{ {
private static IGpuTemperatureProvider? GpuTemperatureProvider; private static IGpuTemperatureProvider? GpuTemperatureProvider;
@@ -19,25 +19,48 @@ public class HardwareMonitor
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true); var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
cpuTemp = ct.NextValue() - 273; cpuTemp = ct.NextValue() - 273;
ct.Dispose(); ct.Dispose();
} catch
{
Logger.WriteLine("Failed reading CPU temp");
}
try
{
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true); var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
batteryDischarge = cb.NextValue() / 1000; batteryDischarge = cb.NextValue() / 1000;
cb.Dispose(); cb.Dispose();
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature(); } catch
}
catch
{ {
Logger.WriteLine("Failed reading sensors"); Logger.WriteLine("Failed reading Battery discharge");
} }
try
{
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
} catch (Exception ex) {
gpuTemp = null;
Logger.WriteLine("Failed reading GPU temp");
Logger.WriteLine(ex.ToString());
}
}
public static void RecreateGpuTemperatureProviderWithRetry() {
RecreateGpuTemperatureProvider();
// Re-enabling the discrete GPU takes a bit of time,
// so a simple workaround is to refresh again after that happens
Task.Run(async () => {
await Task.Delay(TimeSpan.FromSeconds(3));
RecreateGpuTemperatureProvider();
});
} }
public static void RecreateGpuTemperatureProvider() { public static void RecreateGpuTemperatureProvider() {
try { try {
if (GpuTemperatureProvider != null) { GpuTemperatureProvider?.Dispose();
GpuTemperatureProvider.Dispose();
}
// Detect valid GPU temperature provider. // Detect valid GPU temperature provider.
// We start with NVIDIA because there's always at least an integrated AMD GPU // We start with NVIDIA because there's always at least an integrated AMD GPU
IGpuTemperatureProvider gpuTemperatureProvider = new NvidiaGpuTemperatureProvider(); IGpuTemperatureProvider gpuTemperatureProvider = new NvidiaGpuTemperatureProvider();
@@ -57,7 +80,7 @@ public class HardwareMonitor
GpuTemperatureProvider = null; GpuTemperatureProvider = null;
} finally { } finally {
Debug.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}"); Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
} }
} }
} }

View File

@@ -654,6 +654,7 @@ public class NativeMethods
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid); PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
/*
var hrDC = PowerWriteDCValueIndex( var hrDC = PowerWriteDCValueIndex(
IntPtr.Zero, IntPtr.Zero,
activeSchemeGuid, activeSchemeGuid,
@@ -662,7 +663,7 @@ public class NativeMethods
boost); boost);
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid); PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
*/
} }
} }

View File

@@ -8,6 +8,8 @@ public static class Logger
{ {
public static void WriteLine(string logMessage) public static void WriteLine(string logMessage)
{ {
Debug.WriteLine(logMessage);
var appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper"; var appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
var logFile = appPath + "\\log.txt"; var logFile = appPath + "\\log.txt";
@@ -15,7 +17,6 @@ public static class Logger
using (StreamWriter w = File.AppendText(logFile)) using (StreamWriter w = File.AppendText(logFile))
{ {
Debug.WriteLine(logMessage);
w.WriteLine($"{DateTime.Now}: {logMessage}"); w.WriteLine($"{DateTime.Now}: {logMessage}");
} }
@@ -109,6 +110,7 @@ namespace GHelper
settingsForm.SetStartupCheck(Startup.IsScheduled()); settingsForm.SetStartupCheck(Startup.IsScheduled());
SetAutoModes(); SetAutoModes();
HardwareMonitor.RecreateGpuTemperatureProvider();
// Subscribing for native power change events // Subscribing for native power change events
@@ -205,15 +207,6 @@ namespace GHelper
settingsForm.AutoGPUMode(isPlugged); settingsForm.AutoGPUMode(isPlugged);
settingsForm.SetMatrix(isPlugged); settingsForm.SetMatrix(isPlugged);
HardwareMonitor.RecreateGpuTemperatureProvider();
// Re-enabling the discrete GPU takes a bit of time,
// so a simple workaround is to refresh again after that happens
Task.Run(async () => {
await Task.Delay(TimeSpan.FromSeconds(3));
HardwareMonitor.RecreateGpuTemperatureProvider();
});
} }
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)

30
Settings.Designer.cs generated
View File

@@ -112,7 +112,7 @@
panelMatrix.Controls.Add(pictureMatrix); panelMatrix.Controls.Add(pictureMatrix);
panelMatrix.Controls.Add(labelMatrix); panelMatrix.Controls.Add(labelMatrix);
panelMatrix.Dock = DockStyle.Top; panelMatrix.Dock = DockStyle.Top;
panelMatrix.Location = new Point(16, 814); panelMatrix.Location = new Point(16, 806);
panelMatrix.Margin = new Padding(4); panelMatrix.Margin = new Padding(4);
panelMatrix.Name = "panelMatrix"; panelMatrix.Name = "panelMatrix";
panelMatrix.Size = new Size(722, 180); panelMatrix.Size = new Size(722, 180);
@@ -219,7 +219,7 @@
panelBattery.Controls.Add(labelBatteryTitle); panelBattery.Controls.Add(labelBatteryTitle);
panelBattery.Controls.Add(trackBattery); panelBattery.Controls.Add(trackBattery);
panelBattery.Dock = DockStyle.Top; panelBattery.Dock = DockStyle.Top;
panelBattery.Location = new Point(16, 994); panelBattery.Location = new Point(16, 986);
panelBattery.Margin = new Padding(4); panelBattery.Margin = new Padding(4);
panelBattery.Name = "panelBattery"; panelBattery.Name = "panelBattery";
panelBattery.Size = new Size(722, 148); panelBattery.Size = new Size(722, 148);
@@ -290,7 +290,7 @@
panelFooter.Controls.Add(buttonQuit); panelFooter.Controls.Add(buttonQuit);
panelFooter.Controls.Add(checkStartup); panelFooter.Controls.Add(checkStartup);
panelFooter.Dock = DockStyle.Top; panelFooter.Dock = DockStyle.Top;
panelFooter.Location = new Point(16, 1142); panelFooter.Location = new Point(16, 1134);
panelFooter.Margin = new Padding(4); panelFooter.Margin = new Padding(4);
panelFooter.Name = "panelFooter"; panelFooter.Name = "panelFooter";
panelFooter.Size = new Size(722, 64); panelFooter.Size = new Size(722, 64);
@@ -330,7 +330,7 @@
panelPerformance.Location = new Point(16, 16); panelPerformance.Location = new Point(16, 16);
panelPerformance.Margin = new Padding(0); panelPerformance.Margin = new Padding(0);
panelPerformance.Name = "panelPerformance"; panelPerformance.Name = "panelPerformance";
panelPerformance.Size = new Size(722, 228); panelPerformance.Size = new Size(722, 220);
panelPerformance.TabIndex = 36; panelPerformance.TabIndex = 36;
// //
// buttonFans // buttonFans
@@ -383,6 +383,8 @@
// tablePerf // tablePerf
// //
tablePerf.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tablePerf.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tablePerf.AutoScroll = true;
tablePerf.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tablePerf.ColumnCount = 3; tablePerf.ColumnCount = 3;
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tablePerf.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
@@ -452,7 +454,7 @@
panelGPU.Controls.Add(labelGPUFan); panelGPU.Controls.Add(labelGPUFan);
panelGPU.Controls.Add(tableGPU); panelGPU.Controls.Add(tableGPU);
panelGPU.Dock = DockStyle.Top; panelGPU.Dock = DockStyle.Top;
panelGPU.Location = new Point(16, 244); panelGPU.Location = new Point(16, 236);
panelGPU.Margin = new Padding(4); panelGPU.Margin = new Padding(4);
panelGPU.Name = "panelGPU"; panelGPU.Name = "panelGPU";
panelGPU.Size = new Size(722, 216); panelGPU.Size = new Size(722, 216);
@@ -462,7 +464,7 @@
// //
checkGPU.AutoSize = true; checkGPU.AutoSize = true;
checkGPU.ForeColor = SystemColors.GrayText; checkGPU.ForeColor = SystemColors.GrayText;
checkGPU.Location = new Point(27, 154); checkGPU.Location = new Point(27, 155);
checkGPU.Margin = new Padding(4, 2, 4, 2); checkGPU.Margin = new Padding(4, 2, 4, 2);
checkGPU.Name = "checkGPU"; checkGPU.Name = "checkGPU";
checkGPU.Size = new Size(550, 36); checkGPU.Size = new Size(550, 36);
@@ -506,6 +508,8 @@
// tableGPU // tableGPU
// //
tableGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tableGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tableGPU.AutoSize = true;
tableGPU.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableGPU.ColumnCount = 3; tableGPU.ColumnCount = 3;
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
@@ -571,7 +575,7 @@
panelScreen.Controls.Add(pictureScreen); panelScreen.Controls.Add(pictureScreen);
panelScreen.Controls.Add(labelSreen); panelScreen.Controls.Add(labelSreen);
panelScreen.Dock = DockStyle.Top; panelScreen.Dock = DockStyle.Top;
panelScreen.Location = new Point(16, 460); panelScreen.Location = new Point(16, 452);
panelScreen.Margin = new Padding(4); panelScreen.Margin = new Padding(4);
panelScreen.Name = "panelScreen"; panelScreen.Name = "panelScreen";
panelScreen.Size = new Size(722, 200); panelScreen.Size = new Size(722, 200);
@@ -581,7 +585,7 @@
// //
checkScreen.AutoSize = true; checkScreen.AutoSize = true;
checkScreen.ForeColor = SystemColors.GrayText; checkScreen.ForeColor = SystemColors.GrayText;
checkScreen.Location = new Point(27, 153); checkScreen.Location = new Point(27, 154);
checkScreen.Margin = new Padding(4, 2, 4, 2); checkScreen.Margin = new Padding(4, 2, 4, 2);
checkScreen.Name = "checkScreen"; checkScreen.Name = "checkScreen";
checkScreen.Size = new Size(527, 36); checkScreen.Size = new Size(527, 36);
@@ -592,6 +596,8 @@
// tableScreen // tableScreen
// //
tableScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; tableScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tableScreen.AutoSize = true;
tableScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableScreen.ColumnCount = 3; tableScreen.ColumnCount = 3;
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F)); tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
@@ -666,7 +672,7 @@
panelKeyboard.Controls.Add(pictureKeyboard); panelKeyboard.Controls.Add(pictureKeyboard);
panelKeyboard.Controls.Add(label1); panelKeyboard.Controls.Add(label1);
panelKeyboard.Dock = DockStyle.Top; panelKeyboard.Dock = DockStyle.Top;
panelKeyboard.Location = new Point(16, 660); panelKeyboard.Location = new Point(16, 652);
panelKeyboard.Margin = new Padding(4); panelKeyboard.Margin = new Padding(4);
panelKeyboard.Name = "panelKeyboard"; panelKeyboard.Name = "panelKeyboard";
panelKeyboard.Size = new Size(722, 154); panelKeyboard.Size = new Size(722, 154);
@@ -687,7 +693,7 @@
tableLayoutKeyboard.Name = "tableLayoutKeyboard"; tableLayoutKeyboard.Name = "tableLayoutKeyboard";
tableLayoutKeyboard.RowCount = 1; tableLayoutKeyboard.RowCount = 1;
tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutKeyboard.Size = new Size(684, 62); tableLayoutKeyboard.Size = new Size(684, 66);
tableLayoutKeyboard.TabIndex = 39; tableLayoutKeyboard.TabIndex = 39;
// //
// buttonKeyboard // buttonKeyboard
@@ -726,7 +732,7 @@
panelColor.Location = new Point(238, 10); panelColor.Location = new Point(238, 10);
panelColor.Margin = new Padding(10); panelColor.Margin = new Padding(10);
panelColor.Name = "panelColor"; panelColor.Name = "panelColor";
panelColor.Size = new Size(208, 42); panelColor.Size = new Size(208, 46);
panelColor.TabIndex = 36; panelColor.TabIndex = 36;
// //
// pictureColor2 // pictureColor2
@@ -792,7 +798,7 @@
AutoScaleMode = AutoScaleMode.Dpi; AutoScaleMode = AutoScaleMode.Dpi;
AutoSize = true; AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink; AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(754, 1180); ClientSize = new Size(754, 1217);
Controls.Add(panelFooter); Controls.Add(panelFooter);
Controls.Add(panelBattery); Controls.Add(panelBattery);
Controls.Add(panelMatrix); Controls.Add(panelMatrix);

View File

@@ -541,7 +541,7 @@ namespace GHelper
{ {
int currentFrequency = NativeMethods.GetRefreshRate(); int currentFrequency = NativeMethods.GetRefreshRate();
if (currentFrequency < 0) // Laptop screen not detected or has unknown refresh rate if (currentFrequency < 0) // Laptop screen not detected or has unknown refresh rate
{ {
InitScreen(); InitScreen();
@@ -562,7 +562,7 @@ namespace GHelper
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive); Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
InitScreen(); InitScreen();
Logger.WriteLine("Screen "+ frequency.ToString() + "Hz"); Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
} }
@@ -690,7 +690,8 @@ namespace GHelper
if (HardwareMonitor.batteryDischarge > 0) if (HardwareMonitor.batteryDischarge > 0)
battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W"; battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W";
if (HardwareMonitor.gpuTemp != null) { if (HardwareMonitor.gpuTemp != null)
{
gpuTemp = $": {HardwareMonitor.gpuTemp}°C - "; gpuTemp = $": {HardwareMonitor.gpuTemp}°C - ";
} }
@@ -744,7 +745,7 @@ namespace GHelper
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total); Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu); Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
Logger.WriteLine("PowerLimits "+limit_total.ToString() + ", " + limit_cpu.ToString()); Logger.WriteLine("PowerLimits " + limit_total.ToString() + ", " + limit_cpu.ToString());
} }
@@ -802,7 +803,7 @@ namespace GHelper
Program.config.setConfig("performance_mode", PerformanceMode); Program.config.setConfig("performance_mode", PerformanceMode);
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode); Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
Logger.WriteLine("PerfMode " + perfName + " "+ PerformanceMode); Logger.WriteLine("PerfMode " + perfName + " " + PerformanceMode);
if (notify && (oldMode != PerformanceMode)) if (notify && (oldMode != PerformanceMode))
{ {
@@ -934,6 +935,7 @@ namespace GHelper
Program.settingsForm.BeginInvoke(delegate Program.settingsForm.BeginInvoke(delegate
{ {
InitGPUMode(); InitGPUMode();
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
Thread.Sleep(500); Thread.Sleep(500);
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus); AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
}); });
@@ -986,8 +988,11 @@ namespace GHelper
changed = true; changed = true;
} }
if (changed) if (changed) {
Program.config.setConfig("gpu_mode", GPUMode); Program.config.setConfig("gpu_mode", GPUMode);
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
}
if (restart) if (restart)
{ {

View File

@@ -55,7 +55,7 @@
<windowsSettings> <windowsSettings>
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>--> <!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
</windowsSettings> </windowsSettings>
</application> </application>