diff --git a/app/AppConfig.cs b/app/AppConfig.cs index 92a04411..7e089cfb 100644 --- a/app/AppConfig.cs +++ b/app/AppConfig.cs @@ -109,7 +109,8 @@ public static class AppConfig break; } } - } catch (Exception ex) + } + catch (Exception ex) { Logger.WriteLine(ex.Message); } @@ -625,6 +626,15 @@ public static class AppConfig return IsAlly() || Is("stop_ac"); } + public static bool IsChargeLimit80() + { + return ContainsModel("GA403"); + } + public static bool IsChargeLimit6080() + { + return true || IsTUF() && !(ContainsModel("FX507Z") || ContainsModel("FA617")); + + } } diff --git a/app/Battery/BatteryControl.cs b/app/Battery/BatteryControl.cs index c0ebf269..619479e6 100644 --- a/app/Battery/BatteryControl.cs +++ b/app/Battery/BatteryControl.cs @@ -1,5 +1,4 @@ -using GHelper.Helpers; -using System.Diagnostics; +using System.Diagnostics; namespace GHelper.Battery { @@ -37,6 +36,17 @@ namespace GHelper.Battery if (limit < 0) limit = AppConfig.Get("charge_limit"); if (limit < 40 || limit > 100) return; + if (AppConfig.IsChargeLimit80()) + { + limit = (limit <= 80) ? 80 : 100; + } + + if (AppConfig.IsChargeLimit6080()) + { + if (limit > 80) limit = 100; + else if (limit < 60) limit = 60; + } + Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); AppConfig.Set("charge_limit", limit); diff --git a/app/Settings.cs b/app/Settings.cs index 4aec064b..f786a48e 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -12,6 +12,7 @@ using GHelper.Peripherals; using GHelper.Peripherals.Mouse; using GHelper.UI; using GHelper.USB; +using System.Collections.Generic; using System.Diagnostics; using System.Timers; @@ -224,6 +225,7 @@ namespace GHelper sliderBattery.MouseUp += SliderBattery_MouseUp; sliderBattery.KeyUp += SliderBattery_KeyUp; + sliderBattery.ValueChanged += SliderBattery_ValueChanged; Program.trayIcon.MouseMove += TrayIcon_MouseMove; @@ -272,11 +274,17 @@ namespace GHelper InitVisual(); } + private void ButtonFHD_Click(object? sender, EventArgs e) { screenControl.ToogleFHD(); } + private void SliderBattery_ValueChanged(object? sender, EventArgs e) + { + VisualiseBatteryTitle(sliderBattery.Value); + } + private void SliderBattery_KeyUp(object? sender, KeyEventArgs e) { BatteryControl.SetBatteryChargeLimit(sliderBattery.Value); @@ -1710,9 +1718,14 @@ namespace GHelper but.BackColor = but.Enabled ? Color.FromArgb(255, but.BackColor) : Color.FromArgb(100, but.BackColor); } - public void VisualiseBattery(int limit) + public void VisualiseBatteryTitle(int limit) { labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%"; + } + + public void VisualiseBattery(int limit) + { + VisualiseBatteryTitle(limit); sliderBattery.Value = limit; sliderBattery.AccessibleName = Properties.Strings.BatteryChargeLimit + ": " + limit.ToString() + "%";