mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Minor fixes
This commit is contained in:
33
app/Battery/BatteryControl.cs
Normal file
33
app/Battery/BatteryControl.cs
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user