diff --git a/DS4Windows/DS4Control/ControlService.cs b/DS4Windows/DS4Control/ControlService.cs index 859cecf..15cb363 100644 --- a/DS4Windows/DS4Control/ControlService.cs +++ b/DS4Windows/DS4Control/ControlService.cs @@ -695,6 +695,7 @@ namespace DS4Windows public bool[] inWarnMonitor = new bool[4] { false, false, false, false }; private byte[] currentBattery = new byte[4] { 0, 0, 0, 0 }; private bool[] charging = new bool[4] { false, false, false, false }; + private string[] tempStrings = new string[4] { string.Empty, string.Empty, string.Empty, string.Empty }; // Called every time a new input report has arrived protected virtual void On_Report(object sender, EventArgs e) @@ -714,9 +715,13 @@ namespace DS4Windows if (getFlushHIDQueue(ind)) device.FlushHID(); - if (!string.IsNullOrEmpty(device.error)) + string devError = tempStrings[ind] = device.error; + if (!string.IsNullOrEmpty(devError)) { - LogDebug(device.error); + device.getUiContext()?.Post(new SendOrPostCallback(delegate (object state) + { + LogDebug(devError); + }), null); } if (inWarnMonitor[ind]) @@ -749,8 +754,9 @@ namespace DS4Windows device.getCurrentState(CurrentState[ind]); DS4State cState = CurrentState[ind]; - device.getPreviousState(PreviousState[ind]); - DS4State pState = PreviousState[ind]; + DS4State pState = device.getPreviousStateRef(); + //device.getPreviousState(PreviousState[ind]); + //DS4State pState = PreviousState[ind]; if (!device.firstReport && device.IsAlive()) { diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index b47f698..74a973a 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -1239,6 +1239,11 @@ namespace DS4Windows return cState; } + public DS4State getPreviousStateRef() + { + return pState; + } + private bool isDS4Idle() { if (cState.Square || cState.Cross || cState.Circle || cState.Triangle)