Fix zone 2 placement, add colour correction and white balance

Zone 2 is the light under the thumb wheel, not the DPI button. The scroll-wheel
and logo LEDs have much weaker blue than the thumb-wheel LED, so the plugin now
trims their red and green (measured by eye) and applies an optional gamma curve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-19 16:05:14 +01:00
1 parent 25f3e31b8f
commit f4eb036a98
3 files changed
+35 -16

No files matched your search

+6 -6
View File
@@ -13,7 +13,7 @@ HID feature reports, padded to 2053 bytes:
read reply [5, B0, slot, checksum, 733 bytes]
LED block: 3 zones of 191 bytes starting at profile offset 160.
zone 0 = under the scroll wheel, zone 1 = palm logo, zone 2 = DPI button
zone 0 = under the scroll wheel, zone 1 = palm logo, zone 2 = under the thumb wheel
static: [1, brightness, R, G, B]
breathe: [2, 0,0,0,0, period_s lo, hi, 0,0,0,0, 1, brightness, R, G, B]
@@ -34,7 +34,7 @@ FEAT_LEN = 2053
PROFILE_LEN = 733
LED_OFFSET = 160
LED_ZONE_LEN = 191
ZONES = {"scroll": 0, "palm": 1, "dpi": 2}
ZONES = {"scroll": 0, "palm": 1, "thumb": 2}
def checksum(data):
@@ -129,8 +129,8 @@ def zone_colors(args):
if len(cols) == 1:
return {z: cols[0] for z in range(3)}
if len(cols) == 3:
return {ZONES["scroll"]: cols[0], ZONES["palm"]: cols[1], ZONES["dpi"]: cols[2]}
raise SystemExit("give 1 colour (all zones) or 3 colours (scroll palm dpi)")
return {ZONES["scroll"]: cols[0], ZONES["palm"]: cols[1], ZONES["thumb"]: cols[2]}
raise SystemExit("give 1 colour (all zones) or 3 colours (scroll palm thumb)")
def apply(m, args, build):
@@ -152,14 +152,14 @@ def main():
for name, hlp in (("static", "solid colours"), ("breathe", "breathing effect")):
sp = sub.add_parser(name, help=hlp)
sp.add_argument("colors", nargs="+", type=parse_color,
help="RRGGBB, either one for all zones or three: scroll palm dpi")
help="RRGGBB, either one for all zones or three: scroll palm thumb")
sp.add_argument("-b", "--brightness", type=int, default=255)
sp.add_argument("--all-slots", action="store_true", help="write all 4 profiles, not just the active one")
if name == "breathe":
sp.add_argument("-p", "--period", type=int, default=3, help="seconds per breath")
sp = sub.add_parser("live", help="set colours live (RAM only, no storage write; lost on replug)")
sp.add_argument("colors", nargs="+", type=parse_color, help="RRGGBB, one or three: scroll palm dpi")
sp.add_argument("colors", nargs="+", type=parse_color, help="RRGGBB, one or three: scroll palm thumb")
sub.add_parser("release", help="hand the LEDs back to the mouse's own stored lighting")
sp = sub.add_parser("off", help="turn all LEDs off")