diff --git a/app/AsusACPI.cs b/app/AsusACPI.cs index 9c1d7aaf..2d4b64e2 100644 --- a/app/AsusACPI.cs +++ b/app/AsusACPI.cs @@ -106,7 +106,7 @@ public class AsusACPI public const int GPUModeStandard = 1; public const int GPUModeUltimate = 2; - public static int MaxTotal => AppConfig.ContainsModel("G513QY") ? 250 : 150; + public static int MaxTotal => AppConfig.ContainsModel("13QY") ? 250 : 150; public const int MinTotal = 5; public const int DefaultTotal = 125; @@ -396,7 +396,7 @@ public class AsusACPI if (count == 0 && pair.Key >= 40) { fix = true; - pointsFixed.Add(20, 0); + pointsFixed.Add(30, 0); } if (count != 3 || !fix) diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs new file mode 100644 index 00000000..3ff90b29 --- /dev/null +++ b/app/Battery/BatteryControl.cs @@ -0,0 +1,33 @@ +using GHelper.Helpers; +using System.Diagnostics; + +namespace GHelper.Battery +{ + internal class BatteryControl + { + + public static void SetBatteryChargeLimit(int limit = -1) + { + + if (limit < 0) limit = AppConfig.Get("charge_limit"); + if (limit < 40 || limit > 100) return; + + Program.settingsForm.VisualiseBattery(limit); + + Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); + + try + { + OptimizationService.SetChargeLimit(limit); + } + catch (Exception ex) + { + Debug.WriteLine(ex); + } + + AppConfig.Set("charge_limit", limit); + + } + + } +} diff --git a/app/Fans.cs b/app/Fans.cs index 8648c2a4..883d2f07 100644 --- a/app/Fans.cs +++ b/app/Fans.cs @@ -931,7 +931,7 @@ namespace GHelper if (dy < 0) dy = 0; if (dy > fansMax) dy = fansMax; - dymin = (dx - 65) * 1.2; + dymin = (dx - 70) * 1.2; if (dy < dymin) dy = dymin; diff --git a/app/Mode/ModeControl.cs b/app/Mode/ModeControl.cs index f4e29596..c85d9c15 100644 --- a/app/Mode/ModeControl.cs +++ b/app/Mode/ModeControl.cs @@ -1,4 +1,5 @@ -using GHelper.Gpu.NVidia; +using GHelper.Battery; +using GHelper.Gpu.NVidia; using GHelper.Helpers; using Ryzen; @@ -88,6 +89,8 @@ namespace GHelper.Mode PowerNative.SetCPUBoost(AppConfig.GetMode("auto_boost")); } + BatteryControl.SetBatteryChargeLimit(); + /* if (NativeMethods.PowerGetEffectiveOverlayScheme(out Guid activeScheme) == 0) { diff --git a/app/Program.cs b/app/Program.cs index ecb89fab..c78d2250 100644 --- a/app/Program.cs +++ b/app/Program.cs @@ -1,15 +1,14 @@ +using GHelper.Display; using GHelper.Gpu; using GHelper.Helpers; using GHelper.Input; using GHelper.Mode; -using GHelper.Display; using Microsoft.Win32; using Ryzen; using System.Diagnostics; using System.Globalization; using System.Reflection; using static NativeMethods; -using GHelper.AutoUpdate; namespace GHelper { @@ -157,7 +156,6 @@ namespace GHelper inputDispatcher.Init(); - settingsForm.SetBatteryChargeLimit(AppConfig.Get("charge_limit")); modeControl.AutoPerformance(powerChanged); bool switched = gpuControl.AutoGPUMode(); @@ -219,7 +217,7 @@ namespace GHelper case "uv": Startup.ReScheduleAdmin(); settingsForm.FansToggle(2); - modeControl.SetRyzen(); + modeControl.SetRyzen(); break; } } diff --git a/app/Settings.cs b/app/Settings.cs index d842d6e1..c668e1a4 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -1,5 +1,6 @@ using GHelper.AnimeMatrix; using GHelper.AutoUpdate; +using GHelper.Battery; using GHelper.Display; using GHelper.Gpu; using GHelper.Helpers; @@ -331,7 +332,7 @@ namespace GHelper private void SliderBattery_ValueChanged(object? sender, EventArgs e) { - SetBatteryChargeLimit(sliderBattery.Value); + BatteryControl.SetBatteryChargeLimit(sliderBattery.Value); } @@ -1010,29 +1011,10 @@ namespace GHelper but.BackColor = but.Enabled ? Color.FromArgb(255, but.BackColor) : Color.FromArgb(100, but.BackColor); } - - public void SetBatteryChargeLimit(int limit) + public void VisualiseBattery(int limit) { - - if (limit < 40 || limit > 100) return; - - //Debug.WriteLine(limit); - labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%"; sliderBattery.Value = limit; - - Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); - try - { - OptimizationService.SetChargeLimit(limit); - } - catch (Exception ex) - { - Debug.WriteLine(ex); - } - - AppConfig.Set("charge_limit", limit); - }