mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
AutoBattery charge limiter https://github.com/seerge/g-helper/issues/1481
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user