From 49d5df9bac7dc6a461319e7c9f5590f2e20b01c8 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:37:56 +0200 Subject: [PATCH] Toggle one time 100% charge limit https://github.com/seerge/g-helper/issues/1390 --- app/Battery/BatteryControl.cs | 6 ++++++ app/Settings.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index 82559ad6..e2c88ca3 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -3,6 +3,12 @@ internal class BatteryControl { + public static void ToggleBatteryLimitFull() + { + if (AppConfig.Is("charge_full")) SetBatteryChargeLimit(); + else SetBatteryLimitFull(); + } + public static void SetBatteryLimitFull() { AppConfig.Set("charge_full", 1); diff --git a/app/Settings.cs b/app/Settings.cs index 035ccf94..181a8b06 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -214,7 +214,7 @@ namespace GHelper private void ButtonBatteryFull_Click(object? sender, EventArgs e) { - BatteryControl.SetBatteryLimitFull(); + BatteryControl.ToggleBatteryLimitFull(); } private void ButtonBatteryFull_MouseLeave(object? sender, EventArgs e)