mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Rewrote lisp-handler to greatly improve performance for bigger devices (like keyboards)
This commit is contained in:
parent
2b76224383
commit
5a4294499a
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -16,16 +17,21 @@ namespace RGB.NET.Devices.SteelSeries.API
|
|||||||
private const string GAME_NAME = "RGBNET";
|
private const string GAME_NAME = "RGBNET";
|
||||||
private const string GAME_DISPLAYNAME = "RGB.NET";
|
private const string GAME_DISPLAYNAME = "RGB.NET";
|
||||||
private const string EVENT_NAME = "UPDATELEDS";
|
private const string EVENT_NAME = "UPDATELEDS";
|
||||||
private static readonly string HANDLER = $@"(handler ""{EVENT_NAME}""
|
private static readonly string HANDLER = $@"(define (getZone x)
|
||||||
|
(case x
|
||||||
|
{string.Join(Environment.NewLine, Enum.GetValues(typeof(SteelSeriesLedId))
|
||||||
|
.Cast<SteelSeriesLedId>()
|
||||||
|
.Select(x => x.GetAPIName())
|
||||||
|
.Select(ledId => $" ((\"{ledId}\") {ledId}:)"))}
|
||||||
|
))
|
||||||
|
|
||||||
|
(handler ""{EVENT_NAME}""
|
||||||
(lambda (data)
|
(lambda (data)
|
||||||
(let* ((device (value: data))
|
(let* ((device (value: data))
|
||||||
(zoneData (frame: data))
|
(zones (zones: data))
|
||||||
(zones (frame-keys zoneData)))
|
(colors (colors: data)))
|
||||||
(do ((zoneDo zones (cdr zoneDo)))
|
(on-device device show-on-zones: colors (map (lambda (x) (getZone x)) zones)))))
|
||||||
((nil? zoneDo))
|
|
||||||
(let* ((zone (car zoneDo))
|
|
||||||
(color (get-slot zoneData zone)))
|
|
||||||
(on-device device show-on-zone: color zone))))))
|
|
||||||
(add-event-per-key-zone-use ""{EVENT_NAME}"" ""all"")
|
(add-event-per-key-zone-use ""{EVENT_NAME}"" ""all"")
|
||||||
(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-1-zone"")
|
(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-1-zone"")
|
||||||
(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-2-zone"")
|
(add-event-zone-use-with-specifier ""{EVENT_NAME}"" ""all"" ""rgb-2-zone"")
|
||||||
@ -87,7 +93,8 @@ namespace RGB.NET.Devices.SteelSeries.API
|
|||||||
{
|
{
|
||||||
_event.Data.Clear();
|
_event.Data.Clear();
|
||||||
_event.Data.Add("value", device);
|
_event.Data.Add("value", device);
|
||||||
_event.Data.Add("frame", data);
|
_event.Data.Add("colors", data.Values.ToList());
|
||||||
|
_event.Data.Add("zones", data.Keys.ToList());
|
||||||
|
|
||||||
TriggerEvent(_event);
|
TriggerEvent(_event);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user