Skip to content

Commit

Permalink
Auto turn off 100% charge option when battery is fully charged #1485
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Oct 19, 2023
1 parent 168b751 commit 8c1885c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Battery/BatteryControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ public static void SetBatteryLimitFull()
{
AppConfig.Set("charge_full", 1);
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit");

Program.settingsForm.VisualiseBatteryFull();
}

public static void UnSetBatteryLimitFull()
{
AppConfig.Set("charge_full", 0);
Program.settingsForm.VisualiseBatteryFull();
}

public static void AutoBattery(bool init = false)
{
Expand Down
2 changes: 2 additions & 0 deletions app/HardwareControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using GHelper.Helpers;
using System.Diagnostics;
using System.Management;
using GHelper.Battery;

public static class HardwareControl
{
Expand Down Expand Up @@ -211,6 +212,7 @@ public static void ReadSensors()
if (fullCapacity > 0 && chargeCapacity > 0)
{
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
}


Expand Down

0 comments on commit 8c1885c

Please sign in to comment.