Add Lian Li SL-INF wireless tools and SignalRGB plugin
Proof-of-concept tools for the UNI FAN SL-INF Wireless kit (SLV3 TX/RX dongles 0416:8040/8041): a Python scan/colour script, tinyuz helpers, a JavaScript tinyuz encoder, the SignalRGB plugin and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
35240e5dfc
13 files changed
+971
No files matched your search
@@ -0,0 +1,25 @@
|
||||
const { tuzCompress } = require("../tuz.js");
|
||||
const { execFileSync } = require("child_process");
|
||||
let rnd = 12345;
|
||||
const rand = () => (rnd = (rnd * 1103515245 + 12345) & 0x7fffffff) & 0xff;
|
||||
const cases = [];
|
||||
for (const leds of [44, 88, 176]) {
|
||||
cases.push(Array.from({ length: leds * 3 }, (_, i) => [255, 0, 128][i % 3]));
|
||||
cases.push(Array.from({ length: leds * 3 }, (_, i) => (i * 7) & 0xff));
|
||||
cases.push(Array.from({ length: leds * 3 }, rand));
|
||||
cases.push(Array.from({ length: leds * 3 }, (_, i) => (Math.floor(i / 30) * 40) & 0xff));
|
||||
}
|
||||
for (let t = 0; t < 200; t++) {
|
||||
const n = 1 + (rand() * 7) % 700;
|
||||
const alph = 1 + rand() % 6;
|
||||
cases.push(Array.from({ length: n }, () => rand() % alph * 50));
|
||||
}
|
||||
let ok = 0;
|
||||
for (const c of cases) {
|
||||
const code = Buffer.from(tuzCompress(c));
|
||||
const out = execFileSync(require("path").join(__dirname, "..", "tuzd.exe"), [String(c.length)], { input: code });
|
||||
if (Buffer.compare(out, Buffer.from(c)) !== 0) { console.log("MISMATCH len", c.length); process.exit(1); }
|
||||
ok++;
|
||||
}
|
||||
const solid = tuzCompress(Array.from({ length: 132 }, (_, i) => [128, 0, 255][i % 3]));
|
||||
console.log(`${ok}/${cases.length} round-trips ok; solid 44 LEDs -> ${solid.length} bytes`);
|
||||
Reference in new issue
Block a user