mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-13 16:49:08 +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(() =>
|
||||
{
|
||||
ds.ReadWaitEv.Wait();
|
||||
ds.ReadWaitEv.Reset();
|
||||
int x = baseState.LX;
|
||||
int y = baseState.LY;
|
||||
|
||||
@ -272,6 +274,7 @@ namespace DS4WinWPF.DS4Forms
|
||||
}
|
||||
|
||||
prevWarnMode = warnMode;
|
||||
ds.ReadWaitEv.Set();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -429,6 +429,9 @@ namespace DS4Windows
|
||||
return runCalib;
|
||||
}
|
||||
|
||||
private ManualResetEventSlim readWaitEv = new ManualResetEventSlim();
|
||||
public ManualResetEventSlim ReadWaitEv { get => readWaitEv; }
|
||||
|
||||
public DS4Device(HidDevice hidDevice, string disName)
|
||||
{
|
||||
hDevice = hidDevice;
|
||||
@ -809,6 +812,8 @@ namespace DS4Windows
|
||||
//Latency = latencyQueue.Average();
|
||||
Latency = latencySum / tempLatencyCount;
|
||||
|
||||
readWaitEv.Set();
|
||||
|
||||
if (conType == ConnectionType.BT)
|
||||
{
|
||||
//HidDevice.ReadStatus res = hDevice.ReadFile(btInputReport);
|
||||
@ -893,6 +898,9 @@ namespace DS4Windows
|
||||
}
|
||||
}
|
||||
|
||||
readWaitEv.Wait();
|
||||
readWaitEv.Reset();
|
||||
|
||||
curtime = Stopwatch.GetTimestamp();
|
||||
testelapsed = curtime - oldtime;
|
||||
lastTimeElapsedDouble = testelapsed * (1.0 / Stopwatch.Frequency) * 1000.0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user