This commit is contained in:
Serge
2023-10-18 11:45:57 +02:00
parent 8a12e84423
commit 3e93a93ab3
2 changed files with 10 additions and 4 deletions

View File

@@ -18,6 +18,12 @@
} }
public static void AutoBattery(bool init = false)
{
if (AppConfig.Is("charge_full") && !init) SetBatteryLimitFull();
else SetBatteryChargeLimit();
}
public static void SetBatteryChargeLimit(int limit = -1) public static void SetBatteryChargeLimit(int limit = -1)
{ {

View File

@@ -97,7 +97,7 @@ namespace GHelper
gpuControl.InitXGM(); gpuControl.InitXGM();
SetAutoModes(); SetAutoModes(init : true);
// Subscribing for system power change events // Subscribing for system power change events
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
@@ -129,7 +129,7 @@ namespace GHelper
private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e) private static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{ {
gpuControl.StandardModeFix(); gpuControl.StandardModeFix();
BatteryControl.SetBatteryChargeLimit(); BatteryControl.AutoBattery();
} }
private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
@@ -173,7 +173,7 @@ namespace GHelper
public static void SetAutoModes(bool powerChanged = false) public static void SetAutoModes(bool powerChanged = false, bool init = false)
{ {
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 3000) return; if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 3000) return;
@@ -194,7 +194,7 @@ namespace GHelper
screenControl.AutoScreen(); screenControl.AutoScreen();
} }
BatteryControl.SetBatteryChargeLimit(); BatteryControl.AutoBattery(init);
settingsForm.AutoKeyboard(); settingsForm.AutoKeyboard();
settingsForm.matrixControl.SetMatrix(true); settingsForm.matrixControl.SetMatrix(true);