mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Auto turn off 100% charge option when battery is fully charged https://github.com/seerge/g-helper/issues/1485
This commit is contained in:
@@ -13,10 +13,14 @@
|
|||||||
{
|
{
|
||||||
AppConfig.Set("charge_full", 1);
|
AppConfig.Set("charge_full", 1);
|
||||||
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit");
|
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit");
|
||||||
|
|
||||||
Program.settingsForm.VisualiseBatteryFull();
|
Program.settingsForm.VisualiseBatteryFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UnSetBatteryLimitFull()
|
||||||
|
{
|
||||||
|
AppConfig.Set("charge_full", 0);
|
||||||
|
Program.settingsForm.VisualiseBatteryFull();
|
||||||
|
}
|
||||||
|
|
||||||
public static void AutoBattery(bool init = false)
|
public static void AutoBattery(bool init = false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using GHelper.Gpu.AMD;
|
|||||||
using GHelper.Helpers;
|
using GHelper.Helpers;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
|
using GHelper.Battery;
|
||||||
|
|
||||||
public static class HardwareControl
|
public static class HardwareControl
|
||||||
{
|
{
|
||||||
@@ -211,6 +212,7 @@ public static class HardwareControl
|
|||||||
if (fullCapacity > 0 && chargeCapacity > 0)
|
if (fullCapacity > 0 && chargeCapacity > 0)
|
||||||
{
|
{
|
||||||
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
|
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
|
||||||
|
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user