From 6e9cc51a5f25ceb38c8666ad9e4b9ca3cba42b9b Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:53:07 +0200 Subject: [PATCH 1/4] G15 Advantage Edition TDP --- app/AsusACPI.cs | 3 +-- app/GHelper.csproj | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index cff2c73c..e029452f 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -106,8 +106,7 @@ public class AsusACPI public const int GPUModeStandard = 1; public const int GPUModeUltimate = 2; - - public const int MaxTotal = 150; + public static int MaxTotal => AppConfig.ContainsModel("G513QY") ? 250 : 150; public const int MinTotal = 5; public const int DefaultTotal = 125; diff --git a/app/GHelper.csproj b/app/GHelper.csproj index 0e2a18a9..ce248f1d 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ AnyCPU False True - 0.88 + 0.89 From d778838ad4f511888c096fe0b0518347ea48538a Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:15:33 +0200 Subject: [PATCH 2/4] Release script --- .github/workflows/release.yml | 4 ++-- app/Fans.cs | 12 ++++++------ app/Ryzen/Undervolter.cs | 10 ++++++++++ app/Settings.cs | 6 +++--- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad257d74..29fb3fa3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,9 +20,9 @@ jobs: - name: Publish run: | dotnet publish app/GHelper.sln --configuration Release --runtime win-x64 -p:PublishSingleFile=true --no-self-contained - powershell Compress-Archive app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/GHelper.exe GHelper.zip + powershell Compress-Archive app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/* GHelper.zip - name: Upload env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ github.ref_name }} app/bin/x64/Release/net7.0-windows8.0/win-x64/publish/GHelper.exe GHelper.zip + gh release upload ${{ github.ref_name }} GHelper.zip diff --git a/app/Fans.cs b/app/Fans.cs index 7145565e..651f5b3b 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -133,14 +133,14 @@ namespace GHelper labelFansResult.Visible = false; - trackUV.Minimum = -30; - trackUV.Maximum = 0; + trackUV.Minimum = Undervolter.MinCPUUV; + trackUV.Maximum = Undervolter.MaxCPUUV; - trackUViGPU.Minimum = -20; - trackUViGPU.Maximum = 0; + trackUViGPU.Minimum = Undervolter.MinIGPUUV; + trackUViGPU.Maximum = Undervolter.MaxIGPUUV; - trackTemp.Minimum = 75; - trackTemp.Maximum = 97; + trackTemp.Minimum = Undervolter.MinTemp; + trackTemp.Maximum = Undervolter.MaxTemp; FillModes(); diff --git a/app/Ryzen/Undervolter.cs b/app/Ryzen/Undervolter.cs index 45a6d5fc..35dd7a95 100644 --- a/app/Ryzen/Undervolter.cs +++ b/app/Ryzen/Undervolter.cs @@ -10,6 +10,16 @@ namespace Ryzen { internal class Undervolter { + + public const int MinCPUUV = -30; + public const int MaxCPUUV = 0; + + public const int MinIGPUUV = -20; + public const int MaxIGPUUV = 0; + + public const int MinTemp = 75; + public const int MaxTemp = 98; + public static string[] FAM = { "RAVEN", "PICASSO", "DALI", "RENOIR/LUCIENNE", "MATISSE", "VANGOGH", "VERMEER", "CEZANNE/BARCELO", "REMBRANDT", "PHOENIX", "RAPHAEL/DRAGON RANGE" }; public static int FAMID { get; protected set; } diff --git a/app/Settings.cs b/app/Settings.cs index db9fa206..a093405f 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1156,17 +1156,17 @@ namespace GHelper try { - if (cpuUV >= -40 && cpuUV <= 0) + if (cpuUV >= Undervolter.MinCPUUV && cpuUV <= Undervolter.MaxCPUUV) { SendCommand.set_coall(cpuUV); } - if (igpuUV >= -40 && igpuUV <= 0) + if (igpuUV >= Undervolter.MinIGPUUV && igpuUV <= Undervolter.MaxIGPUUV) { SendCommand.set_cogfx(igpuUV); } - if (cpuTemp >= 70 && cpuTemp <= 97) + if (cpuTemp >= Undervolter.MinTemp && cpuTemp <= Undervolter.MaxTemp) { SendCommand.set_tctl_temp((uint)cpuTemp); SendCommand.set_apu_skin_temp_limit((uint)cpuTemp); From f31b05dcd11f0c0da18a6001e6a803f0892edeb7 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:48:32 +0200 Subject: [PATCH 3/4] Aura cleanup --- app/AsusUSB.cs | 40 +++++++++++++++++-------------------- app/Gpu/NvidiaGpuControl.cs | 11 ++++++++-- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/app/AsusUSB.cs b/app/AsusUSB.cs index 638731bc..2458f3b9 100644 --- a/app/AsusUSB.cs +++ b/app/AsusUSB.cs @@ -179,13 +179,11 @@ namespace GHelper } - private static IEnumerable GetHidDevices(int[] deviceIds, int minInput = 18, int minFeatures = 1) + private static IEnumerable GetHidDevices(int[] deviceIds, int minFeatures = 1) { HidDevice[] HidDeviceList = HidDevices.Enumerate(ASUS_ID, deviceIds).ToArray(); foreach (HidDevice device in HidDeviceList) - if (device.IsConnected - && device.Capabilities.FeatureReportByteLength >= minFeatures - && device.Capabilities.InputReportByteLength >= minInput) + if (device.IsConnected && device.Capabilities.FeatureReportByteLength >= minFeatures) yield return device; } @@ -235,7 +233,7 @@ namespace GHelper { Task.Run(async () => { - var devices = GetHidDevices(deviceIds, 0); + var devices = GetHidDevices(deviceIds); foreach (HidDevice device in devices) { device.OpenDevice(); @@ -263,7 +261,7 @@ namespace GHelper byte[] msg = { AURA_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; - var devices = GetHidDevices(deviceIds, 0); + var devices = GetHidDevices(deviceIds); foreach (HidDevice device in devices) { device.OpenDevice(); @@ -289,7 +287,7 @@ namespace GHelper { byte[] msgBackup = { INPUT_HID_ID, 0xba, 0xc5, 0xc4, (byte)brightness }; - var devicesBackup = GetHidDevices(deviceIds, 0); + var devicesBackup = GetHidDevices(deviceIds); foreach (HidDevice device in devicesBackup) { device.OpenDevice(); @@ -312,13 +310,15 @@ namespace GHelper var devices = GetHidDevices(deviceIds); - //Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg)); foreach (HidDevice device in devices) { device.OpenDevice(); - device.WriteFeatureData(msg); - Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg)); + if (device.ReadFeatureData(out byte[] data, AURA_HID_ID)) + { + device.WriteFeatureData(msg); + Logger.WriteLine("USB-KB " + device.Attributes.ProductHexId + ":" + BitConverter.ToString(msg)); + } device.CloseDevice(); } @@ -351,23 +351,19 @@ namespace GHelper } byte[] msg = AuraMessage(Mode, Color1, Color2, _speed); - var devices = GetHidDevices(deviceIds); - if (devices.Count() == 0) - { - Logger.WriteLine("USB-KB : not found"); - devices = GetHidDevices(deviceIds, 1); - } - foreach (HidDevice device in devices) { device.OpenDevice(); - device.WriteFeatureData(msg); - device.WriteFeatureData(MESSAGE_SET); - device.WriteFeatureData(MESSAGE_APPLY); + if (device.ReadFeatureData(out byte[] data, AURA_HID_ID)) + { + device.WriteFeatureData(msg); + //device.WriteFeatureData(MESSAGE_SET); + device.WriteFeatureData(MESSAGE_APPLY); + Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg)); + } device.CloseDevice(); - Logger.WriteLine("USB-KB " + device.Capabilities.FeatureReportByteLength + "|" + device.Capabilities.InputReportByteLength + device.Description + device.DevicePath + ":" + BitConverter.ToString(msg)); } if (AppConfig.ContainsModel("TUF")) @@ -385,7 +381,7 @@ namespace GHelper var payload = new byte[300]; Array.Copy(msg, payload, msg.Length); - foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 0, 300)) + foreach (HidDevice device in GetHidDevices(new int[] { 0x1970 }, 300)) { device.OpenDevice(); Logger.WriteLine("XGM " + device.Attributes.ProductHexId + "|" + device.Capabilities.FeatureReportByteLength + ":" + BitConverter.ToString(msg)); diff --git a/app/Gpu/NvidiaGpuControl.cs b/app/Gpu/NvidiaGpuControl.cs index e4be904b..80830079 100644 --- a/app/Gpu/NvidiaGpuControl.cs +++ b/app/Gpu/NvidiaGpuControl.cs @@ -79,6 +79,12 @@ public class NvidiaGpuControl : IGpuControl core = states.Clocks[PerformanceStateId.P0_3DPerformance][0].FrequencyDeltaInkHz.DeltaValue / 1000; memory = states.Clocks[PerformanceStateId.P0_3DPerformance][1].FrequencyDeltaInkHz.DeltaValue / 1000; Logger.WriteLine($"GET GPU CLOCKS: {core}, {memory}"); + + foreach (var delta in states.Voltages[PerformanceStateId.P0_3DPerformance]) + { + Logger.WriteLine("GPU VOLT:" + delta.IsEditable + " - " + delta.ValueDeltaInMicroVolt.DeltaValue); + } + return 0; } @@ -117,7 +123,7 @@ public class NvidiaGpuControl : IGpuControl return status; } - public int SetClocks(int core, int memory) + public int SetClocks(int core, int memory, int voltage = 0) { if (core < MinCoreOffset || core > MaxCoreOffset) return 0; @@ -127,9 +133,10 @@ public class NvidiaGpuControl : IGpuControl var coreClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Graphics, new PerformanceStates20ParameterDelta(core * 1000)); var memoryClock = new PerformanceStates20ClockEntryV1(PublicClockDomain.Memory, new PerformanceStates20ParameterDelta(memory * 1000)); + var voltageEntry = new PerformanceStates20BaseVoltageEntryV1(PerformanceVoltageDomain.Core, new PerformanceStates20ParameterDelta(voltage)); PerformanceStates20ClockEntryV1[] clocks = { coreClock, memoryClock }; - PerformanceStates20BaseVoltageEntryV1[] voltages = { }; + PerformanceStates20BaseVoltageEntryV1[] voltages = { }; PerformanceState20[] performanceStates = { new PerformanceState20(PerformanceStateId.P0_3DPerformance, clocks, voltages) }; From 40ecdf0d35af2ed0e80101a5af9b3f3f616e3afc Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 20 Jun 2023 16:20:14 +0200 Subject: [PATCH 4/4] Max GPU core/memory config settings --- app/Gpu/NvidiaGpuControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Gpu/NvidiaGpuControl.cs b/app/Gpu/NvidiaGpuControl.cs index 80830079..53c9b220 100644 --- a/app/Gpu/NvidiaGpuControl.cs +++ b/app/Gpu/NvidiaGpuControl.cs @@ -11,8 +11,8 @@ namespace GHelper.Gpu; public class NvidiaGpuControl : IGpuControl { - public const int MaxCoreOffset = 250; - public const int MaxMemoryOffset = 250; + public static int MaxCoreOffset => AppConfig.Get("max_gpu_core", 250); + public static int MaxMemoryOffset => AppConfig.Get("max_gpu_memory", 250); public const int MinCoreOffset = -250; public const int MinMemoryOffset = -250;