Move Quick Charge check to input thread

This commit is contained in:
Travis Nickles 2017-06-09 23:45:19 -07:00
parent e1efb2bb5b
commit ab9c3abe05
2 changed files with 19 additions and 3 deletions

View File

@ -276,7 +276,7 @@ namespace DS4Windows
{
// Do first run check for Quick Charge checks. Needed so old device will
// be removed before performing another controller scan
if (getQuickCharge())
/*if (getQuickCharge())
{
for (int i = 0, devlen = DS4Controllers.Length; i < devlen; i++)
{
@ -291,6 +291,7 @@ namespace DS4Windows
}
}
}
*/
DS4Devices.findControllers();
IEnumerable<DS4Device> devices = DS4Devices.getDS4Controllers();

View File

@ -639,6 +639,8 @@ namespace DS4Windows
Queue<long> latencyQueue = new Queue<long>(51); // Set capacity at max + 1 to avoid any resizing
int tempLatencyCount = 0;
long oldtime = 0;
string currerror = string.Empty;
long curtime = 0;
Stopwatch sw = new Stopwatch();
sw.Start();
timeoutEvent = false;
@ -646,8 +648,8 @@ namespace DS4Windows
while (!exitInputThread)
{
oldCharging = charging;
string currerror = string.Empty;
long curtime = sw.ElapsedMilliseconds;
currerror = string.Empty;
curtime = sw.ElapsedMilliseconds;
this.lastTimeElapsed = curtime - oldtime;
//latencyList.Add(this.lastTimeElapsed);
latencyQueue.Enqueue(this.lastTimeElapsed);
@ -888,7 +890,10 @@ namespace DS4Windows
if (conType == ConnectionType.BT)
{
if (DisconnectBT(true))
{
timeoutExecuted = true;
return; // all done
}
}
else if (conType == ConnectionType.SONYWA)
{
@ -897,6 +902,16 @@ namespace DS4Windows
}
}
if (oldCharging != charging && conType == ConnectionType.BT)
{
if (Global.getQuickCharge() && charging)
{
DisconnectBT(true);
timeoutExecuted = true;
return;
}
}
if (Report != null)
Report(this, EventArgs.Empty);