diff --git a/RELEASE.md b/RELEASE.md index e6ff777..3ffad55 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -20,3 +20,4 @@ It does help this project on being supported. - Re-open Neptune controller every 10 failures - Manage Steam default controller configs to prevent double inputs (in DEBUG, change Settings) - Fix bug with unable to select controller profile from OSD +- Skip repeated haptic requests diff --git a/SteamController/Devices/SteamControllerHaptic.cs b/SteamController/Devices/SteamControllerHaptic.cs index ce4f34b..0030d86 100644 --- a/SteamController/Devices/SteamControllerHaptic.cs +++ b/SteamController/Devices/SteamControllerHaptic.cs @@ -62,8 +62,13 @@ namespace SteamController.Devices public SDCHapticPacket2() { } } + private Task? hapticTask; + public bool SendHaptic(byte position, sbyte intensity) { + if (hapticTask?.IsCompleted == false) + return false; + var ts = Random.Shared.Next(); var haptic = new SDCHapticPacket2() @@ -82,7 +87,7 @@ namespace SteamController.Devices try { Marshal.StructureToPtr(haptic, handle.AddrOfPinnedObject(), false); - neptuneDevice.RequestFeatureReportAsync(bytes); + hapticTask = neptuneDevice.RequestFeatureReportAsync(bytes); return true; } catch (Exception e)