From 712f470b9e6d4b226bd5b5635b583c0dcc75a9a7 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 14 Jun 2017 07:42:29 -0700 Subject: [PATCH] Change scope of some variables --- DS4Windows/DS4Library/DS4Device.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index f4ab65a..e567a18 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -649,6 +649,9 @@ namespace DS4Windows sw.Start(); timeoutEvent = false; + int maxBatteryValue = 0; + int tempBattery = 0; + while (!exitInputThread) { oldCharging = charging; @@ -807,8 +810,8 @@ namespace DS4Windows try { charging = (inputReport[30] & 0x10) != 0; - int maxBatteryValue = charging ? BATTERY_MAX_USB : BATTERY_MAX; - int tempBattery = (inputReport[30] & 0x0f) * 100 / maxBatteryValue; + maxBatteryValue = charging ? BATTERY_MAX_USB : BATTERY_MAX; + tempBattery = (inputReport[30] & 0x0f) * 100 / maxBatteryValue; battery = Math.Min((byte)tempBattery, (byte)100); cState.Battery = (byte)battery; //System.Diagnostics.Debug.WriteLine("CURRENT BATTERY: " + (inputReport[30] & 0x0f) + " | " + tempBattery + " | " + battery);