Change to keep lightbar from sticking in some situations

Hopefully resolves issue #126.
This commit is contained in:
Travis Nickles 2017-10-27 02:09:42 -05:00
parent a7f4dec009
commit 677191e8b4

View File

@ -578,11 +578,13 @@ namespace DS4Windows
}
}
private byte outputPendCount = 0;
private void performDs4Output()
{
try
{
int lastError = 0;
outputPendCount = 3;
while (!exitOutputThread)
{
bool result = false;
@ -593,6 +595,7 @@ namespace DS4Windows
{
outputReportBuffer.CopyTo(outputReport, 0);
outputRumble = false;
outputPendCount--;
}
result = writeOutput();
@ -1096,12 +1099,17 @@ namespace DS4Windows
}
else
{
bool output = false;
bool output = outputPendCount > 0;
for (int i = 0, arlen = outputReport.Length; !output && i < arlen; i++)
output = outputReport[i] != outputReportBuffer[i];
if (output)
{
if (outputPendCount == 0)
{
outputPendCount = 3;
}
outputRumble = true;
Monitor.Pulse(outputReportBuffer);
}