Fix possible exception in battery fully charged https://github.com/seerge/g-helper/issues/3317

This commit is contained in:
Serge
2024-10-28 16:19:05 +01:00
parent e6a547dbfd
commit 083e918086
2 changed files with 21 additions and 8 deletions

View File

@@ -241,7 +241,7 @@ public static class HardwareControl
if (fullCapacity > 0 && chargeCapacity > 0)
{
batteryCapacity = Math.Min(100, (decimal)chargeCapacity / (decimal)fullCapacity * 100);
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
if (batteryCapacity > 99 && BatteryControl.chargeFull) BatteryControl.UnSetBatteryLimitFull();
if (chargeWatt)
{
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh";
@@ -251,8 +251,6 @@ public static class HardwareControl
batteryCharge = Math.Round(batteryCapacity, 1) + "%";
}
}
}
public static bool IsUsedGPU(int threshold = 10)