mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Move Quick Charge check to input thread
This commit is contained in:
parent
e1efb2bb5b
commit
ab9c3abe05
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user