Fixed charging status indicator reporting incorrect current values

This commit is contained in:
Gus
2019-07-27 09:35:02 +02:00
parent 5dae1da560
commit b56595ac27
3 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -123,13 +123,13 @@ namespace WPinternals
return (UInt32)((Response[0] << 24) | (Response[1] << 16) | (Response[2] << 8) | Response[3]) + 1;
}
public uint? ReadCurrentChargeCurrent()
public int? ReadCurrentChargeCurrent()
{
byte[] Response = ReadParam("CS");
if ((Response == null) || (Response.Length != 8)) return null;
// This value is in big endian and needs to be XOR'd with 0xFFFFFFFF
return ((UInt32)((Response[4] << 24) | (Response[5] << 16) | (Response[6] << 8) | Response[7]) ^ 0xFFFFFFFF) + 1;
return (Int32)(((Response[4] << 24) | (Response[5] << 16) | (Response[6] << 8) | Response[7]) ^ 0xFFFFFFFF) + 1;
}
public UefiSecurityStatusResponse ReadSecurityStatus()
+7 -1
View File
@@ -189,7 +189,13 @@ namespace WPinternals
eMMC = Manufacturer + " " + MemSizeDouble.ToString() + " GB";
SamsungWarningVisible = (MID == 0x0015);
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + CurrentModel.ReadCurrentChargeCurrent() + " mA";
int chargecurrent = CurrentModel.ReadCurrentChargeCurrent().Value;
if (chargecurrent < 0)
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + ((-1) * CurrentModel.ReadCurrentChargeCurrent()) + " mA (discharging)";
else
ChargingStatus = CurrentModel.ReadCurrentChargeLevel() + "% - " + CurrentModel.ReadCurrentChargeCurrent() + " mA (charging)";
LogFile.Log("Charging status: " + ChargingStatus);
PhoneInfo Info = CurrentModel.ReadPhoneInfo(true);
+1 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>G:\Projects\Misc\WPinternals\WPinternals.Core\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>G:\Projects\Misc\WPinternals\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<Page Update="App.xaml">
@@ -98,7 +98,6 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-Test|AnyCPU'">
<StartArguments>-test</StartArguments>
</PropertyGroup>