Skip to content

Commit

Permalink
把SetLed方法改了回去
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanheiii committed Dec 28, 2021
1 parent b27d41e commit 5af11d6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions MU3Input/IO/HidIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,26 @@ private void PollThread()
}
}

public override void SetLed(uint data)
public unsafe override void SetLed(uint data)
{
if (!IsConnected)
return;
_hid.Send(0, BitConverter.GetBytes(data), sizeof(uint), 1000);

SetLedInput led;
led.Type = 0;
led.LedBrightness = 40;

for (var i = 0; i < 9; i++)
{
led.LedColors[i] = (byte)(((data >> bitPosMap[i]) & 1) * 255);
led.LedColors[i + 15] = (byte)(((data >> bitPosMap[i + 9]) & 1) * 255);
}

var outBuffer = new byte[64];
fixed (void* d = outBuffer)
CopyMemory(d, &led, 64);

_hid.Send(0, outBuffer, 64, 1000);
}

public override unsafe void SetAimiId(byte[] id)
Expand Down

0 comments on commit 5af11d6

Please sign in to comment.