Vial firmware for the wired Royal Kludge R75 (WB32FQ95), based on mossbed/r75 vialrgb and checked against RK's own R75 source: - the keymap is generated from the factory keymap read off the keyboard (factory reset moved to Fn+RShift+Space) - the Caps Lock LED uses RK's pin C4 instead of matrix column C9 - five custom RGB matrix effects (synthwave, glitch, heartbeat, plasma, scanner) - raw HID command 0xC7: custom effect select, colour/speed for any effect, and alert overlays drawn over the running effect - host simulator in sim/ to preview the effects as PNGs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
import json, sys, colorsys
|
|
sys.path.insert(0, __import__("os").path.expanduser("~/htdocs/cyberdeck/herdr/plugins/cyberdeck-keyboard"))
|
|
import keyboard as k
|
|
from PIL import Image, ImageDraw
|
|
pts = [(p["x"], p["y"]) for p in json.load(open("../keyboards/rk/r75/keyboard.json"))["rgb_matrix"]["layout"]]
|
|
frames = []
|
|
class Fake(k.Cyberdeck):
|
|
def __init__(self): self.effects = [("x", True, 0)]
|
|
def leds(self): return pts
|
|
def info(self): return bytes([0xC7, 1, 1, 5, 40, 41, 1, 0, 255, 200, 96]) + bytes(21)
|
|
def state(self): return k.State(0, 0, 255, 200, 96)
|
|
def direct_on(self, st): pass
|
|
def push(self, f): frames.append(list(f))
|
|
def restore_mode(self, m): pass
|
|
k.connect = lambda: ("/dev/fake", None, Fake())
|
|
k.time.sleep = lambda s: None
|
|
k.scroll(sys.argv[1])
|
|
pick = frames[::int(sys.argv[2])][:10]
|
|
S, FH = 3, 64 * 3 + 40
|
|
img = Image.new("RGB", (224 * S + 60, FH * len(pick)), (8, 8, 12))
|
|
d = ImageDraw.Draw(img)
|
|
for n, f in enumerate(pick):
|
|
for (x, y), (h, s, v) in zip(pts, f):
|
|
r, g, b = colorsys.hsv_to_rgb(h / 255, s / 255, v / 255)
|
|
cx, cy = 30 + x * S, n * FH + 20 + y * S
|
|
d.rectangle([cx - 18, cy - 13, cx + 18, cy + 13], fill=(int(r * 255), int(g * 255), int(b * 255)), outline=(40, 40, 50))
|
|
img = img.resize((img.width * 6 // 10, img.height * 6 // 10)); img.save("scroll.png"); print(len(frames), "frames", img.size)
|