This commit is contained in:
Serge
2024-06-01 11:16:10 +02:00
parent 34161eee7c
commit bf4eae6081
3 changed files with 37 additions and 4 deletions

View File

@@ -109,7 +109,8 @@ public static class AppConfig
break;
}
}
} catch (Exception ex)
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
@@ -625,6 +626,15 @@ public static class AppConfig
return IsAlly() || Is("stop_ac");
}
public static bool IsChargeLimit80()
{
return ContainsModel("GA403");
}
public static bool IsChargeLimit6080()
{
return true || IsTUF() && !(ContainsModel("FX507Z") || ContainsModel("FA617"));
}
}

View File

@@ -1,5 +1,4 @@
using GHelper.Helpers;
using System.Diagnostics;
using System.Diagnostics;
namespace GHelper.Battery
{
@@ -37,6 +36,17 @@ namespace GHelper.Battery
if (limit < 0) limit = AppConfig.Get("charge_limit");
if (limit < 40 || limit > 100) return;
if (AppConfig.IsChargeLimit80())
{
limit = (limit <= 80) ? 80 : 100;
}
if (AppConfig.IsChargeLimit6080())
{
if (limit > 80) limit = 100;
else if (limit < 60) limit = 60;
}
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
AppConfig.Set("charge_limit", limit);

View File

@@ -12,6 +12,7 @@ using GHelper.Peripherals;
using GHelper.Peripherals.Mouse;
using GHelper.UI;
using GHelper.USB;
using System.Collections.Generic;
using System.Diagnostics;
using System.Timers;
@@ -224,6 +225,7 @@ namespace GHelper
sliderBattery.MouseUp += SliderBattery_MouseUp;
sliderBattery.KeyUp += SliderBattery_KeyUp;
sliderBattery.ValueChanged += SliderBattery_ValueChanged;
Program.trayIcon.MouseMove += TrayIcon_MouseMove;
@@ -272,11 +274,17 @@ namespace GHelper
InitVisual();
}
private void ButtonFHD_Click(object? sender, EventArgs e)
{
screenControl.ToogleFHD();
}
private void SliderBattery_ValueChanged(object? sender, EventArgs e)
{
VisualiseBatteryTitle(sliderBattery.Value);
}
private void SliderBattery_KeyUp(object? sender, KeyEventArgs e)
{
BatteryControl.SetBatteryChargeLimit(sliderBattery.Value);
@@ -1710,9 +1718,14 @@ namespace GHelper
but.BackColor = but.Enabled ? Color.FromArgb(255, but.BackColor) : Color.FromArgb(100, but.BackColor);
}
public void VisualiseBattery(int limit)
public void VisualiseBatteryTitle(int limit)
{
labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%";
}
public void VisualiseBattery(int limit)
{
VisualiseBatteryTitle(limit);
sliderBattery.Value = limit;
sliderBattery.AccessibleName = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%";