Change scope of some variables

This commit is contained in:
Travis Nickles 2017-06-14 07:42:29 -07:00
parent 6ff8221e5e
commit 712f470b9e

View File

@ -649,6 +649,9 @@ namespace DS4Windows
sw.Start(); sw.Start();
timeoutEvent = false; timeoutEvent = false;
int maxBatteryValue = 0;
int tempBattery = 0;
while (!exitInputThread) while (!exitInputThread)
{ {
oldCharging = charging; oldCharging = charging;
@ -807,8 +810,8 @@ namespace DS4Windows
try try
{ {
charging = (inputReport[30] & 0x10) != 0; charging = (inputReport[30] & 0x10) != 0;
int maxBatteryValue = charging ? BATTERY_MAX_USB : BATTERY_MAX; maxBatteryValue = charging ? BATTERY_MAX_USB : BATTERY_MAX;
int tempBattery = (inputReport[30] & 0x0f) * 100 / maxBatteryValue; tempBattery = (inputReport[30] & 0x0f) * 100 / maxBatteryValue;
battery = Math.Min((byte)tempBattery, (byte)100); battery = Math.Min((byte)tempBattery, (byte)100);
cState.Battery = (byte)battery; cState.Battery = (byte)battery;
//System.Diagnostics.Debug.WriteLine("CURRENT BATTERY: " + (inputReport[30] & 0x0f) + " | " + tempBattery + " | " + battery); //System.Diagnostics.Debug.WriteLine("CURRENT BATTERY: " + (inputReport[30] & 0x0f) + " | " + tempBattery + " | " + battery);