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,30 @@
|
||||
# Send colours compressed by the JS encoder (tuz.js) and check the fan confirms them.
|
||||
import os, subprocess, sys, time
|
||||
TOOLS = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
|
||||
sys.path.insert(0, TOOLS)
|
||||
import lianli_poc as p
|
||||
|
||||
def js_tinyuz(raw):
|
||||
js = "const {tuzCompress}=require(process.argv[1]);process.stdout.write(Buffer.from(tuzCompress([...Buffer.from(process.argv[2],'hex')])))"
|
||||
return subprocess.run(["node", "-e", js, TOOLS + "/tuz.js", raw.hex()], capture_output=True, check=True).stdout
|
||||
|
||||
p.tinyuz = js_tinyuz
|
||||
tx, rx = p.Dongle(p.TX_ID, "TX"), p.Dongle(p.RX_ID, "RX")
|
||||
try:
|
||||
master, ch, _ = p.find_master(tx)
|
||||
dev = [d for d in p.get_devices(rx) if d["master"] == master][0]
|
||||
# gradient frame exercises dict matches and literals, then back to purple
|
||||
grad = [(i * 5, 0, 255 - i * 5) for i in range(44)]
|
||||
for name, colors in [("gradient", grad), ("purple", [(128, 0, 255)] * 44)]:
|
||||
up = p.build_upload(colors)
|
||||
# reuse set_color's send path with a custom frame
|
||||
n = (len(up["compressed"]) + p.CHUNK_BYTES - 1) // p.CHUNK_BYTES + 1
|
||||
for i in range(n):
|
||||
pkt = p.rgb_packet(up, dev["mac"], master, i)
|
||||
for _ in range(2 if i == 0 else 1):
|
||||
p.send_rf(tx, ch, dev["rx"], pkt); time.sleep(0.002)
|
||||
ok = p.wait_for_effect(rx, dev["mac"], up["effect"])
|
||||
print(name, len(up["compressed"]), "bytes", "confirmed" if ok else "NOT confirmed")
|
||||
time.sleep(3)
|
||||
finally:
|
||||
tx.close(); rx.close()
|
||||
Reference in new issue
Block a user