mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Show remaining battery charge in Wh https://github.com/seerge/g-helper/issues/3246
This commit is contained in:
@@ -24,7 +24,7 @@ public static class HardwareControl
|
||||
public static decimal? fullCapacity;
|
||||
public static decimal? chargeCapacity;
|
||||
|
||||
|
||||
public static string? batteryCharge;
|
||||
|
||||
public static string? cpuFan;
|
||||
public static string? gpuFan;
|
||||
@@ -226,7 +226,8 @@ public static class HardwareControl
|
||||
|
||||
if (fullCapacity > 0 && chargeCapacity > 0)
|
||||
{
|
||||
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100);
|
||||
batteryCapacity = Math.Min(100, (decimal)chargeCapacity / (decimal)fullCapacity * 100);
|
||||
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh" + " " + Math.Round(batteryCapacity, 1) + "%";
|
||||
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull();
|
||||
}
|
||||
|
||||
|
||||
@@ -1420,7 +1420,9 @@ namespace GHelper
|
||||
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
|
||||
|
||||
if (HardwareControl.batteryCapacity > 0)
|
||||
charge = Properties.Strings.BatteryCharge + ": " + Math.Round(HardwareControl.batteryCapacity, 1) + "% ";
|
||||
{
|
||||
charge = Properties.Strings.BatteryCharge + ": " + HardwareControl.batteryCharge;
|
||||
}
|
||||
|
||||
if (HardwareControl.batteryRate < 0)
|
||||
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
|
||||
|
||||
Reference in New Issue
Block a user