Minor fixes

This commit is contained in:
Serge
2023-07-03 18:18:46 +02:00
parent 767865ab19
commit 606f43380b
6 changed files with 45 additions and 29 deletions

View File

@@ -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)

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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();

View File

@@ -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);
}