mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Custom payloads for Slash Lighting
This commit is contained in:
@@ -103,7 +103,14 @@ namespace GHelper.AnimeMatrix
|
|||||||
switch ((SlashMode)running)
|
switch ((SlashMode)running)
|
||||||
{
|
{
|
||||||
case SlashMode.Static:
|
case SlashMode.Static:
|
||||||
deviceSlash.SetStatic(brightness);
|
var custom = AppConfig.GetString("slash_custom");
|
||||||
|
if (custom is not null && custom.Length > 0)
|
||||||
|
{
|
||||||
|
deviceSlash.SetCustom(AppConfig.StringToBytes(custom));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
deviceSlash.SetStatic(brightness);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
deviceSlash.SetMode((SlashMode)running);
|
deviceSlash.SetMode((SlashMode)running);
|
||||||
|
|||||||
@@ -119,13 +119,18 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void SetStatic(int brightness = 0)
|
public void SetStatic(int brightness = 0)
|
||||||
{
|
{
|
||||||
byte brightnessByte = (byte)(brightness * 85.333);
|
SetCustom(Enumerable.Repeat((byte)(brightness * 85.333), 7).ToArray());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCustom(byte[] data)
|
||||||
|
{
|
||||||
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAC), "Static");
|
Set(Packet<SlashPacket>(0xD2, 0x02, 0x01, 0x08, 0xAC), "Static");
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF), "StaticSettings");
|
Set(Packet<SlashPacket>(0xD3, 0x03, 0x01, 0x08, 0xAC, 0xFF, 0xFF, 0x01, 0x05, 0xFF, 0xFF), "StaticSettings");
|
||||||
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAC), "StaticSave");
|
Set(Packet<SlashPacket>(0xD4, 0x00, 0x00, 0x01, 0xAC), "StaticSave");
|
||||||
|
|
||||||
Set(Packet<SlashPacket>(0xD3, 0x00, 0x00, 0x07, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte, brightnessByte), "Static White");
|
byte[] payload = new byte[] { 0xD3, 0x00, 0x00, 0x07 };
|
||||||
|
Set(Packet<SlashPacket>(payload.Concat(data.Take(7)).ToArray()), "Static Data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOptions(bool status, int brightness = 0, int interval = 0)
|
public void SetOptions(bool status, int brightness = 0, int interval = 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user