Compare commits

...

27 Commits
v0.26 ... v0.27

Author SHA1 Message Date
seerge
9bb5e41a5d Fixed auto resolution switching in some exotic cases 2023-03-14 15:39:56 +01:00
seerge
bc965c003d Merge branch 'main' of https://github.com/seerge/g14-helper 2023-03-14 14:21:23 +01:00
seerge
a6cfc91de2 Added log cleanup 2023-03-14 14:21:20 +01:00
Serge
9ca6ec657f Update README.md 2023-03-14 12:55:22 +01:00
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
11 changed files with 170 additions and 116 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 chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
panelFans = new Panel();
labelBoost = new Label();
comboBoost = new ComboBox();
picturePerf = new PictureBox();
tableFanCharts = new TableLayoutPanel();
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
checkBoost = new CheckBox();
labelFans = new Label();
checkAuto = new CheckBox();
buttonReset = new Button();
@@ -72,9 +73,10 @@
//
// panelFans
//
panelFans.Controls.Add(labelBoost);
panelFans.Controls.Add(comboBoost);
panelFans.Controls.Add(picturePerf);
panelFans.Controls.Add(tableFanCharts);
panelFans.Controls.Add(checkBoost);
panelFans.Controls.Add(labelFans);
panelFans.Controls.Add(checkAuto);
panelFans.Controls.Add(buttonReset);
@@ -87,6 +89,26 @@
panelFans.Size = new Size(824, 1159);
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.BackgroundImage = Properties.Resources.icons8_fan_head_96;
@@ -106,7 +128,7 @@
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableFanCharts.Controls.Add(chartGPU, 0, 1);
tableFanCharts.Controls.Add(chartCPU, 0, 0);
tableFanCharts.Location = new Point(28, 68);
tableFanCharts.Location = new Point(28, 64);
tableFanCharts.Margin = new Padding(6);
tableFanCharts.Name = "tableFanCharts";
tableFanCharts.RowCount = 2;
@@ -114,7 +136,7 @@
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.Size = new Size(764, 988);
tableFanCharts.Size = new Size(764, 992);
tableFanCharts.TabIndex = 36;
//
// chartGPU
@@ -122,10 +144,10 @@
chartArea1.Name = "ChartArea1";
chartGPU.ChartAreas.Add(chartArea1);
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.Name = "chartGPU";
chartGPU.Size = new Size(760, 474);
chartGPU.Size = new Size(760, 476);
chartGPU.TabIndex = 17;
chartGPU.Text = "chart1";
//
@@ -137,22 +159,10 @@
chartCPU.Location = new Point(2, 10);
chartCPU.Margin = new Padding(2, 10, 2, 10);
chartCPU.Name = "chartCPU";
chartCPU.Size = new Size(760, 474);
chartCPU.Size = new Size(760, 476);
chartCPU.TabIndex = 14;
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.AutoSize = true;
@@ -268,7 +278,7 @@
panelCPU.Controls.Add(labelCPU);
panelCPU.Controls.Add(label2);
panelCPU.Controls.Add(trackCPU);
panelCPU.Location = new Point(184, 90);
panelCPU.Location = new Point(184, 93);
panelCPU.Margin = new Padding(4);
panelCPU.Name = "panelCPU";
panelCPU.Size = new Size(160, 510);
@@ -315,7 +325,7 @@
panelTotal.Controls.Add(labelTotal);
panelTotal.Controls.Add(label1);
panelTotal.Controls.Add(trackTotal);
panelTotal.Location = new Point(16, 90);
panelTotal.Location = new Point(16, 93);
panelTotal.Margin = new Padding(4);
panelTotal.Name = "panelTotal";
panelTotal.Size = new Size(160, 512);
@@ -362,7 +372,7 @@
//
labelApplied.AutoSize = true;
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.Name = "labelApplied";
labelApplied.Size = new Size(143, 32);
@@ -453,9 +463,10 @@
private TableLayoutPanel tableFanCharts;
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
private System.Windows.Forms.DataVisualization.Charting.Chart chartCPU;
private CheckBox checkBoost;
private Label labelFans;
private PictureBox picturePerf;
private PictureBox pictureBox1;
private ComboBox comboBoost;
private Label labelBoost;
}
}

18
Fans.cs
View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
using System.Diagnostics;
using GHelper.Gpu;
public class HardwareMonitor
public static class HardwareMonitor
{
private static IGpuTemperatureProvider? GpuTemperatureProvider;
@@ -19,25 +19,48 @@ public class HardwareMonitor
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
cpuTemp = ct.NextValue() - 273;
ct.Dispose();
} catch
{
Logger.WriteLine("Failed reading CPU temp");
}
try
{
var cb = new PerformanceCounter("Power Meter", "Power", "Power Meter (0)", true);
batteryDischarge = cb.NextValue() / 1000;
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() {
try {
if (GpuTemperatureProvider != null) {
GpuTemperatureProvider.Dispose();
}
GpuTemperatureProvider?.Dispose();
// Detect valid GPU temperature provider.
// We start with NVIDIA because there's always at least an integrated AMD GPU
IGpuTemperatureProvider gpuTemperatureProvider = new NvidiaGpuTemperatureProvider();
@@ -57,7 +80,7 @@ public class HardwareMonitor
GpuTemperatureProvider = null;
} finally {
Debug.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
Logger.WriteLine($"GpuTemperatureProvider: {GpuTemperatureProvider?.GetType().Name}");
}
}
}

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using static Tools.ScreenInterrogatory;
using System.Windows.Forms;
namespace Tools
{
@@ -545,22 +546,19 @@ public class NativeMethods
foreach (var device in devices)
{
if (device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL)
if (device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL ||
device.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED)
{
displayNum = count;
}
count++;
//Debug.WriteLine(device.outputTechnology);
//Debug.WriteLine(device.monitorFriendlyDeviceName);
//Logger.WriteLine(device.outputTechnology.ToString());
//Logger.WriteLine(device.monitorFriendlyDeviceName);
}
var screens = Screen.AllScreens;
if (screens.Length != count)
{
Debug.WriteLine("Mismatch between enumerated and available screens");
return null;
}
if (screens.Length != count) return null;
count = 0;
foreach (var screen in screens)
@@ -569,13 +567,15 @@ public class NativeMethods
{
laptopScreen = screen.DeviceName;
}
//Debug.WriteLine(screen.DeviceName);
//Logger.WriteLine(screen.DeviceName);
count++;
}
}
catch
catch (Exception ex)
{
Debug.WriteLine("Can't find internal screen");
Logger.WriteLine(ex.ToString());
Logger.WriteLine("Can't detect internal screen");
//laptopScreen = Screen.PrimaryScreen.DeviceName;
}
@@ -654,6 +654,7 @@ public class NativeMethods
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
/*
var hrDC = PowerWriteDCValueIndex(
IntPtr.Zero,
activeSchemeGuid,
@@ -662,7 +663,7 @@ public class NativeMethods
boost);
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
*/
}
}

View File

@@ -6,19 +6,36 @@ using System.Runtime.InteropServices;
using System.Text.Json;
public static class Logger
{
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
static string logFile = appPath + "\\log.txt";
public static void WriteLine(string logMessage)
{
var appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
var logFile = appPath + "\\log.txt";
Debug.WriteLine(logMessage);
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
using (StreamWriter w = File.AppendText(logFile))
try
{
Debug.WriteLine(logMessage);
w.WriteLine($"{DateTime.Now}: {logMessage}");
using (StreamWriter w = File.AppendText(logFile))
{
w.WriteLine($"{DateTime.Now}: {logMessage}");
w.Close();
}
} catch
{
}
if (new Random().Next(100) == 1) Cleanup();
}
public static void Cleanup()
{
var file = File.ReadAllLines(logFile);
int skip = Math.Max(0, file.Count() - 500);
File.WriteAllLines(logFile,file.Skip(skip).ToArray());
}
}
@@ -109,6 +126,7 @@ namespace GHelper
settingsForm.SetStartupCheck(Startup.IsScheduled());
SetAutoModes();
HardwareMonitor.RecreateGpuTemperatureProvider();
// Subscribing for native power change events
@@ -202,18 +220,11 @@ namespace GHelper
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
settingsForm.AutoPerformance(isPlugged);
settingsForm.AutoGPUMode(isPlugged);
bool switched = settingsForm.AutoGPUMode(isPlugged);
if (!switched) settingsForm.AutoScreen(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)

View File

@@ -1,4 +1,6 @@
# G-Helper / GHelper for Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
# G-Helper / GHelper
## For Asus ROG Zephyrus G14, G15, Flow X13, Flow X16, and other models
A small utility that allows you do almost everyting you could do with Armory Crate but without extra bloat and unnecessary services.

54
Settings.Designer.cs generated
View File

@@ -112,7 +112,7 @@
panelMatrix.Controls.Add(pictureMatrix);
panelMatrix.Controls.Add(labelMatrix);
panelMatrix.Dock = DockStyle.Top;
panelMatrix.Location = new Point(16, 814);
panelMatrix.Location = new Point(16, 806);
panelMatrix.Margin = new Padding(4);
panelMatrix.Name = "panelMatrix";
panelMatrix.Size = new Size(722, 180);
@@ -193,7 +193,7 @@
//
pictureMatrix.BackgroundImage = Properties.Resources.icons8_matrix_desktop_48;
pictureMatrix.BackgroundImageLayout = ImageLayout.Zoom;
pictureMatrix.Location = new Point(29, 10);
pictureMatrix.Location = new Point(25, 10);
pictureMatrix.Margin = new Padding(4, 2, 4, 2);
pictureMatrix.Name = "pictureMatrix";
pictureMatrix.Size = new Size(36, 36);
@@ -204,7 +204,7 @@
//
labelMatrix.AutoSize = true;
labelMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelMatrix.Location = new Point(68, 12);
labelMatrix.Location = new Point(64, 12);
labelMatrix.Margin = new Padding(4, 0, 4, 0);
labelMatrix.Name = "labelMatrix";
labelMatrix.Size = new Size(170, 32);
@@ -219,7 +219,7 @@
panelBattery.Controls.Add(labelBatteryTitle);
panelBattery.Controls.Add(trackBattery);
panelBattery.Dock = DockStyle.Top;
panelBattery.Location = new Point(16, 994);
panelBattery.Location = new Point(16, 986);
panelBattery.Margin = new Padding(4);
panelBattery.Name = "panelBattery";
panelBattery.Size = new Size(722, 148);
@@ -252,7 +252,7 @@
//
pictureBattery.BackgroundImage = (Image)resources.GetObject("pictureBattery.BackgroundImage");
pictureBattery.BackgroundImageLayout = ImageLayout.Zoom;
pictureBattery.Location = new Point(29, 10);
pictureBattery.Location = new Point(25, 10);
pictureBattery.Margin = new Padding(4, 2, 4, 2);
pictureBattery.Name = "pictureBattery";
pictureBattery.Size = new Size(36, 38);
@@ -262,7 +262,7 @@
// labelBatteryTitle
//
labelBatteryTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelBatteryTitle.Location = new Point(70, 12);
labelBatteryTitle.Location = new Point(66, 12);
labelBatteryTitle.Margin = new Padding(4, 0, 4, 0);
labelBatteryTitle.Name = "labelBatteryTitle";
labelBatteryTitle.Size = new Size(408, 36);
@@ -290,7 +290,7 @@
panelFooter.Controls.Add(buttonQuit);
panelFooter.Controls.Add(checkStartup);
panelFooter.Dock = DockStyle.Top;
panelFooter.Location = new Point(16, 1142);
panelFooter.Location = new Point(16, 1134);
panelFooter.Margin = new Padding(4);
panelFooter.Name = "panelFooter";
panelFooter.Size = new Size(722, 64);
@@ -330,7 +330,7 @@
panelPerformance.Location = new Point(16, 16);
panelPerformance.Margin = new Padding(0);
panelPerformance.Name = "panelPerformance";
panelPerformance.Size = new Size(722, 228);
panelPerformance.Size = new Size(722, 220);
panelPerformance.TabIndex = 36;
//
// buttonFans
@@ -351,7 +351,7 @@
picturePerf.BackgroundImage = (Image)resources.GetObject("picturePerf.BackgroundImage");
picturePerf.BackgroundImageLayout = ImageLayout.Zoom;
picturePerf.InitialImage = null;
picturePerf.Location = new Point(29, 10);
picturePerf.Location = new Point(25, 10);
picturePerf.Margin = new Padding(4, 2, 4, 2);
picturePerf.Name = "picturePerf";
picturePerf.Size = new Size(36, 38);
@@ -362,7 +362,7 @@
//
labelPerf.AutoSize = true;
labelPerf.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelPerf.Location = new Point(68, 12);
labelPerf.Location = new Point(64, 12);
labelPerf.Margin = new Padding(4, 0, 4, 0);
labelPerf.Name = "labelPerf";
labelPerf.Size = new Size(234, 32);
@@ -383,6 +383,8 @@
// tablePerf
//
tablePerf.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tablePerf.AutoScroll = true;
tablePerf.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tablePerf.ColumnCount = 3;
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(tableGPU);
panelGPU.Dock = DockStyle.Top;
panelGPU.Location = new Point(16, 244);
panelGPU.Location = new Point(16, 236);
panelGPU.Margin = new Padding(4);
panelGPU.Name = "panelGPU";
panelGPU.Size = new Size(722, 216);
@@ -462,7 +464,7 @@
//
checkGPU.AutoSize = true;
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.Name = "checkGPU";
checkGPU.Size = new Size(550, 36);
@@ -474,7 +476,7 @@
//
pictureGPU.BackgroundImage = (Image)resources.GetObject("pictureGPU.BackgroundImage");
pictureGPU.BackgroundImageLayout = ImageLayout.Zoom;
pictureGPU.Location = new Point(29, 10);
pictureGPU.Location = new Point(25, 10);
pictureGPU.Margin = new Padding(4, 2, 4, 2);
pictureGPU.Name = "pictureGPU";
pictureGPU.Size = new Size(36, 38);
@@ -485,7 +487,7 @@
//
labelGPU.AutoSize = true;
labelGPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelGPU.Location = new Point(70, 12);
labelGPU.Location = new Point(66, 12);
labelGPU.Margin = new Padding(4, 0, 4, 0);
labelGPU.Name = "labelGPU";
labelGPU.Size = new Size(136, 32);
@@ -506,6 +508,8 @@
// tableGPU
//
tableGPU.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tableGPU.AutoSize = true;
tableGPU.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableGPU.ColumnCount = 3;
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(labelSreen);
panelScreen.Dock = DockStyle.Top;
panelScreen.Location = new Point(16, 460);
panelScreen.Location = new Point(16, 452);
panelScreen.Margin = new Padding(4);
panelScreen.Name = "panelScreen";
panelScreen.Size = new Size(722, 200);
@@ -581,7 +585,7 @@
//
checkScreen.AutoSize = true;
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.Name = "checkScreen";
checkScreen.Size = new Size(527, 36);
@@ -592,6 +596,8 @@
// tableScreen
//
tableScreen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tableScreen.AutoSize = true;
tableScreen.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tableScreen.ColumnCount = 3;
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
tableScreen.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33.33333F));
@@ -642,7 +648,7 @@
//
pictureScreen.BackgroundImage = (Image)resources.GetObject("pictureScreen.BackgroundImage");
pictureScreen.BackgroundImageLayout = ImageLayout.Zoom;
pictureScreen.Location = new Point(29, 8);
pictureScreen.Location = new Point(25, 8);
pictureScreen.Margin = new Padding(4, 2, 4, 2);
pictureScreen.Name = "pictureScreen";
pictureScreen.Size = new Size(36, 38);
@@ -653,7 +659,7 @@
//
labelSreen.AutoSize = true;
labelSreen.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
labelSreen.Location = new Point(72, 10);
labelSreen.Location = new Point(68, 10);
labelSreen.Margin = new Padding(4, 0, 4, 0);
labelSreen.Name = "labelSreen";
labelSreen.Size = new Size(176, 32);
@@ -666,7 +672,7 @@
panelKeyboard.Controls.Add(pictureKeyboard);
panelKeyboard.Controls.Add(label1);
panelKeyboard.Dock = DockStyle.Top;
panelKeyboard.Location = new Point(16, 660);
panelKeyboard.Location = new Point(16, 652);
panelKeyboard.Margin = new Padding(4);
panelKeyboard.Name = "panelKeyboard";
panelKeyboard.Size = new Size(722, 154);
@@ -687,7 +693,7 @@
tableLayoutKeyboard.Name = "tableLayoutKeyboard";
tableLayoutKeyboard.RowCount = 1;
tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutKeyboard.Size = new Size(684, 62);
tableLayoutKeyboard.Size = new Size(684, 66);
tableLayoutKeyboard.TabIndex = 39;
//
// buttonKeyboard
@@ -726,7 +732,7 @@
panelColor.Location = new Point(238, 10);
panelColor.Margin = new Padding(10);
panelColor.Name = "panelColor";
panelColor.Size = new Size(208, 42);
panelColor.Size = new Size(208, 46);
panelColor.TabIndex = 36;
//
// pictureColor2
@@ -768,7 +774,7 @@
//
pictureKeyboard.BackgroundImage = Properties.Resources.icons8_keyboard_48;
pictureKeyboard.BackgroundImageLayout = ImageLayout.Zoom;
pictureKeyboard.Location = new Point(29, 16);
pictureKeyboard.Location = new Point(25, 16);
pictureKeyboard.Margin = new Padding(4, 2, 4, 2);
pictureKeyboard.Name = "pictureKeyboard";
pictureKeyboard.Size = new Size(36, 36);
@@ -779,7 +785,7 @@
//
label1.AutoSize = true;
label1.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
label1.Location = new Point(72, 16);
label1.Location = new Point(68, 16);
label1.Margin = new Padding(4, 0, 4, 0);
label1.Name = "label1";
label1.Size = new Size(210, 32);
@@ -792,7 +798,7 @@
AutoScaleMode = AutoScaleMode.Dpi;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new Size(754, 1180);
ClientSize = new Size(754, 1217);
Controls.Add(panelFooter);
Controls.Add(panelBattery);
Controls.Add(panelMatrix);

View File

@@ -541,7 +541,7 @@ namespace GHelper
{
int currentFrequency = NativeMethods.GetRefreshRate();
if (currentFrequency < 0) // Laptop screen not detected or has unknown refresh rate
{
InitScreen();
@@ -562,7 +562,7 @@ namespace GHelper
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
InitScreen();
Logger.WriteLine("Screen "+ frequency.ToString() + "Hz");
Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
}
@@ -690,7 +690,8 @@ namespace GHelper
if (HardwareMonitor.batteryDischarge > 0)
battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W";
if (HardwareMonitor.gpuTemp != null) {
if (HardwareMonitor.gpuTemp != null)
{
gpuTemp = $": {HardwareMonitor.gpuTemp}°C - ";
}
@@ -744,7 +745,7 @@ namespace GHelper
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
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.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
Logger.WriteLine("PerfMode " + perfName + " "+ PerformanceMode);
Logger.WriteLine("PerfMode " + perfName + " " + PerformanceMode);
if (notify && (oldMode != PerformanceMode))
{
@@ -857,33 +858,33 @@ namespace GHelper
}
public void AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
{
int GpuAuto = Program.config.getConfig("gpu_auto");
if (GpuAuto != 1) return;
if (GpuAuto != 1) return false;
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
if (mux == 0) // GPU in Ultimate, ignore
return;
return false;
else
{
if (eco == 1 && Plugged == PowerLineStatus.Online) // Eco going Standard on plugged
{
SetEcoGPU(0);
return true;
}
else if (eco == 0 && Plugged != PowerLineStatus.Online) // Standard going Eco on plugged
{
SetEcoGPU(1);
}
else
{
AutoScreen(Plugged);
return true;
}
}
return false;
}
public int InitGPUMode()
@@ -934,6 +935,7 @@ namespace GHelper
Program.settingsForm.BeginInvoke(delegate
{
InitGPUMode();
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
Thread.Sleep(500);
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
});
@@ -987,8 +989,12 @@ namespace GHelper
}
if (changed)
{
Program.config.setConfig("gpu_mode", GPUMode);
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
}
if (restart)
{
VisualiseGPUMode(GPUMode);

View File

@@ -55,7 +55,7 @@
<windowsSettings>
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
<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>
</application>