mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-01-06 08:39:59 +01:00
Skip repeated haptic requests
This commit is contained in:
parent
40da017804
commit
f4431105e3
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue