Manually calculate device latency average

This commit is contained in:
Travis Nickles 2018-11-16 05:24:47 -06:00
parent 5d1b4b9a4f
commit dedb1c9ad9

View File

@ -741,6 +741,7 @@ namespace DS4Windows
CRC32_POS_3 = BT_INPUT_REPORT_CRC32_POS + 3;
int crcpos = BT_INPUT_REPORT_CRC32_POS;
int crcoffset = 0;
long latencySum = 0;
while (!exitInputThread)
{
@ -749,14 +750,16 @@ namespace DS4Windows
if (tempLatencyCount >= 20)
{
latencyQueue.Dequeue();
latencySum -= latencyQueue.Dequeue();
tempLatencyCount--;
}
latencySum += this.lastTimeElapsed;
latencyQueue.Enqueue(this.lastTimeElapsed);
tempLatencyCount++;
Latency = latencyQueue.Average();
//Latency = latencyQueue.Average();
Latency = latencySum / tempLatencyCount;
if (conType == ConnectionType.BT)
{