mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 11:04:21 +01:00
Send output packet at least once every 4 seconds
Best attempt at resolving issue #399.
This commit is contained in:
parent
1a8548e5b9
commit
cceaa31404
@ -615,6 +615,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
private byte outputPendCount = 0;
|
private byte outputPendCount = 0;
|
||||||
|
private readonly Stopwatch standbySw = new Stopwatch();
|
||||||
private unsafe void performDs4Output()
|
private unsafe void performDs4Output()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -658,6 +659,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
//outReportBuffer.CopyTo(outputReport, 0);
|
//outReportBuffer.CopyTo(outputReport, 0);
|
||||||
outputPendCount--;
|
outputPendCount--;
|
||||||
|
standbySw.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRumble = true;
|
currentRumble = true;
|
||||||
@ -742,6 +744,7 @@ namespace DS4Windows
|
|||||||
int crcpos = BT_INPUT_REPORT_CRC32_POS;
|
int crcpos = BT_INPUT_REPORT_CRC32_POS;
|
||||||
int crcoffset = 0;
|
int crcoffset = 0;
|
||||||
long latencySum = 0;
|
long latencySum = 0;
|
||||||
|
standbySw.Start();
|
||||||
|
|
||||||
while (!exitInputThread)
|
while (!exitInputThread)
|
||||||
{
|
{
|
||||||
@ -1192,9 +1195,11 @@ namespace DS4Windows
|
|||||||
if (synchronous)
|
if (synchronous)
|
||||||
{
|
{
|
||||||
outputPendCount = 3;
|
outputPendCount = 3;
|
||||||
|
output = output || standbySw.ElapsedMilliseconds >= 4000L;
|
||||||
if (change)
|
if (output || change)
|
||||||
{
|
{
|
||||||
|
standbySw.Reset();
|
||||||
|
|
||||||
if (usingBT)
|
if (usingBT)
|
||||||
{
|
{
|
||||||
Monitor.Enter(outputReport);
|
Monitor.Enter(outputReport);
|
||||||
@ -1226,6 +1231,7 @@ namespace DS4Windows
|
|||||||
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
|
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
|
||||||
// change = outputReport[i] != outReportBuffer[i];
|
// change = outputReport[i] != outReportBuffer[i];
|
||||||
|
|
||||||
|
output = output || standbySw.ElapsedMilliseconds >= 4000L;
|
||||||
if (output || change)
|
if (output || change)
|
||||||
{
|
{
|
||||||
if (change)
|
if (change)
|
||||||
|
Loading…
Reference in New Issue
Block a user