mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-27 23:35:31 +01:00
Added wait event to use for refreshing controller readings
Only display state change when device is waiting for new report
This commit is contained in:
parent
f7a08fae6e
commit
08018d27a1
@ -183,6 +183,8 @@ namespace DS4WinWPF.DS4Forms
|
|||||||
|
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
ds.ReadWaitEv.Wait();
|
||||||
|
ds.ReadWaitEv.Reset();
|
||||||
int x = baseState.LX;
|
int x = baseState.LX;
|
||||||
int y = baseState.LY;
|
int y = baseState.LY;
|
||||||
|
|
||||||
@ -272,6 +274,7 @@ namespace DS4WinWPF.DS4Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
prevWarnMode = warnMode;
|
prevWarnMode = warnMode;
|
||||||
|
ds.ReadWaitEv.Set();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,6 +429,9 @@ namespace DS4Windows
|
|||||||
return runCalib;
|
return runCalib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ManualResetEventSlim readWaitEv = new ManualResetEventSlim();
|
||||||
|
public ManualResetEventSlim ReadWaitEv { get => readWaitEv; }
|
||||||
|
|
||||||
public DS4Device(HidDevice hidDevice, string disName)
|
public DS4Device(HidDevice hidDevice, string disName)
|
||||||
{
|
{
|
||||||
hDevice = hidDevice;
|
hDevice = hidDevice;
|
||||||
@ -809,6 +812,8 @@ namespace DS4Windows
|
|||||||
//Latency = latencyQueue.Average();
|
//Latency = latencyQueue.Average();
|
||||||
Latency = latencySum / tempLatencyCount;
|
Latency = latencySum / tempLatencyCount;
|
||||||
|
|
||||||
|
readWaitEv.Set();
|
||||||
|
|
||||||
if (conType == ConnectionType.BT)
|
if (conType == ConnectionType.BT)
|
||||||
{
|
{
|
||||||
//HidDevice.ReadStatus res = hDevice.ReadFile(btInputReport);
|
//HidDevice.ReadStatus res = hDevice.ReadFile(btInputReport);
|
||||||
@ -893,6 +898,9 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readWaitEv.Wait();
|
||||||
|
readWaitEv.Reset();
|
||||||
|
|
||||||
curtime = Stopwatch.GetTimestamp();
|
curtime = Stopwatch.GetTimestamp();
|
||||||
testelapsed = curtime - oldtime;
|
testelapsed = curtime - oldtime;
|
||||||
lastTimeElapsedDouble = testelapsed * (1.0 / Stopwatch.Frequency) * 1000.0;
|
lastTimeElapsedDouble = testelapsed * (1.0 / Stopwatch.Frequency) * 1000.0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user