Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1f461534e | ||
|
|
f4eb036a98 |
No files matched your search
+31
-8
@@ -19,21 +19,42 @@ LightingMode:readonly
|
|||||||
forcedColor:readonly
|
forcedColor:readonly
|
||||||
shutdownMode:readonly
|
shutdownMode:readonly
|
||||||
shutdownColor:readonly
|
shutdownColor:readonly
|
||||||
|
colorCorrection:readonly
|
||||||
|
whiteBalance:readonly
|
||||||
|
thumbBrightness:readonly
|
||||||
*/
|
*/
|
||||||
export function ControllableParameters() {
|
export function ControllableParameters() {
|
||||||
return [
|
return [
|
||||||
{property:"LightingMode", group:"lighting", label:"Lighting Mode", description:"Canvas follows the active effect, Forced uses one fixed colour", type:"combobox", values:["Canvas", "Forced"], default:"Canvas"},
|
{property:"LightingMode", group:"lighting", label:"Lighting Mode", description:"Canvas follows the active effect, Forced uses one fixed colour", type:"combobox", values:["Canvas", "Forced"], default:"Canvas"},
|
||||||
{property:"forcedColor", group:"lighting", label:"Forced Color", min:"0", max:"360", type:"color", default:"#009bde"},
|
{property:"forcedColor", group:"lighting", label:"Forced Color", min:"0", max:"360", type:"color", default:"#009bde"},
|
||||||
|
{property:"colorCorrection", group:"lighting", label:"Colour Correction", description:"The LEDs respond linearly, so in-between colours look pale next to a screen. Higher values darken mid-tones and make colours richer", type:"combobox", values:["Off", "Light (1.8)", "Normal (2.2)", "Strong (2.8)"], default:"Normal (2.2)"},
|
||||||
|
{property:"whiteBalance", group:"lighting", label:"White Balance", description:"The scroll-wheel and logo LEDs have much weaker blue than the thumb-wheel LED, so colours there look pale and warm. Balanced trims their red and green to match (reds and greens get dimmer there)", type:"combobox", values:["Balanced", "Off"], default:"Balanced"},
|
||||||
|
{property:"thumbBrightness", group:"lighting", label:"Thumb Wheel Brightness", description:"With White Balance on, the scroll wheel and logo are dimmer, so turn the thumb-wheel light down until all three match", type:"number", min:"0", max:"100", default:"40"},
|
||||||
{property:"shutdownMode", group:"lighting", label:"On Exit", description:"What the mouse shows when SignalRGB closes. 'Save last colours' stores them in the active profile (one storage write), so they survive replugging", type:"combobox", values:["Mouse's own lighting", "Shutdown Color", "Save last colours to mouse"], default:"Mouse's own lighting"},
|
{property:"shutdownMode", group:"lighting", label:"On Exit", description:"What the mouse shows when SignalRGB closes. 'Save last colours' stores them in the active profile (one storage write), so they survive replugging", type:"combobox", values:["Mouse's own lighting", "Shutdown Color", "Save last colours to mouse"], default:"Mouse's own lighting"},
|
||||||
{property:"shutdownColor", group:"lighting", label:"Shutdown Color", min:"0", max:"360", type:"color", default:"#000000"},
|
{property:"shutdownColor", group:"lighting", label:"Shutdown Color", min:"0", max:"360", type:"color", default:"#000000"},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = DPI button
|
// Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = under the thumb wheel (left side)
|
||||||
const vLedNames = ["Scroll Wheel", "DPI Button", "Palm Logo"];
|
const vLedNames = ["Scroll Wheel", "Thumb Wheel", "Palm Logo"];
|
||||||
const vLedPositions = [[1, 0], [1, 1], [1, 2]];
|
const vLedPositions = [[1, 0], [0, 1], [1, 2]];
|
||||||
const vZoneForLed = [0, 2, 1];
|
const vZoneForLed = [0, 2, 1];
|
||||||
|
|
||||||
|
const GAMMA = {"Off": 1, "Light (1.8)": 1.8, "Normal (2.2)": 2.2, "Strong (2.8)": 2.8};
|
||||||
|
|
||||||
|
// Per-zone R/G/B scale, measured by eye against the thumb-wheel LED (2026-11-19)
|
||||||
|
const ZONE_BALANCE = [[0.15, 0.10, 1], [0.15, 0.10, 1], [1, 1, 1]];
|
||||||
|
|
||||||
|
function corrected(c, zone) {
|
||||||
|
const g = GAMMA[colorCorrection] || 1;
|
||||||
|
let k = whiteBalance === "Off" ? [1, 1, 1] : ZONE_BALANCE[zone];
|
||||||
|
if (whiteBalance !== "Off" && zone === 2) {
|
||||||
|
const t = Math.min(100, Math.max(0, Number(thumbBrightness))) / 100;
|
||||||
|
k = k.map(v => v * (isNaN(t) ? 0.4 : t));
|
||||||
|
}
|
||||||
|
return c.map((v, i) => Math.round(255 * Math.pow(v / 255, g) * k[i]));
|
||||||
|
}
|
||||||
|
|
||||||
const FEAT_LEN = 2053;
|
const FEAT_LEN = 2053;
|
||||||
const PROFILE_LEN = 733;
|
const PROFILE_LEN = 733;
|
||||||
const LED_OFFSET = 160;
|
const LED_OFFSET = 160;
|
||||||
@@ -98,8 +119,9 @@ export function Shutdown(SystemSuspending) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setZone(zone, c) {
|
function setZone(zone, c) {
|
||||||
device.send_report([12, 0xC4, 3, 4, 1, zone, c[0], c[1], c[2]], FEAT_LEN);
|
const o = corrected(c, zone);
|
||||||
sent[zone] = c;
|
device.send_report([12, 0xC4, 3, 4, 1, zone, o[0], o[1], o[2]], FEAT_LEN);
|
||||||
|
sent[zone] = c; // uncorrected, so unchanged canvas colours aren't resent
|
||||||
}
|
}
|
||||||
|
|
||||||
function releaseLeds() {
|
function releaseLeds() {
|
||||||
@@ -158,9 +180,10 @@ function saveToProfile(colors) {
|
|||||||
const o = LED_OFFSET + z * LED_ZONE_LEN;
|
const o = LED_OFFSET + z * LED_ZONE_LEN;
|
||||||
profile[o] = 1; // static
|
profile[o] = 1; // static
|
||||||
profile[o + 1] = 255; // brightness
|
profile[o + 1] = 255; // brightness
|
||||||
profile[o + 2] = colors[z][0];
|
const c = corrected(colors[z], z);
|
||||||
profile[o + 3] = colors[z][1];
|
profile[o + 2] = c[0];
|
||||||
profile[o + 4] = colors[z][2];
|
profile[o + 3] = c[1];
|
||||||
|
profile[o + 4] = c[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
device.send_report([5, 0, s, checksum(profile, 0, PROFILE_LEN)].concat(profile), FEAT_LEN);
|
device.send_report([5, 0, s, checksum(profile, 0, PROFILE_LEN)].concat(profile), FEAT_LEN);
|
||||||
|
|||||||
@@ -14,14 +14,16 @@ The plugin streams colours live with a firmware command the vendor app never use
|
|||||||
to the LED driver with no storage writes, so it doesn't wear anything out. It handles
|
to the LED driver with no storage writes, so it doesn't wear anything out. It handles
|
||||||
110+ updates a second. The `static`/`breathe`/`off` commands below change the stored
|
110+ updates a second. The `static`/`breathe`/`off` commands below change the stored
|
||||||
profile instead (one storage write each), which survives replugging.
|
profile instead (one storage write each), which survives replugging.
|
||||||
Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = DPI button.
|
Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = under the thumb wheel.
|
||||||
|
The scroll-wheel and logo LEDs have much weaker blue than the thumb-wheel LED; the plugin
|
||||||
|
scales their red to 15% and green to 10% ("White Balance") plus a gamma setting.
|
||||||
|
|
||||||
```
|
```
|
||||||
python rat8.py live ff0000 00ff00 0000ff # RAM only, until release/replug
|
python rat8.py live ff0000 00ff00 0000ff # RAM only, until release/replug
|
||||||
python rat8.py release # back to the stored lighting
|
python rat8.py release # back to the stored lighting
|
||||||
python rat8.py info
|
python rat8.py info
|
||||||
python rat8.py static 00aaff # all zones
|
python rat8.py static 00aaff # all zones
|
||||||
python rat8.py static ff0000 00ff00 0000ff # scroll palm dpi
|
python rat8.py static ff0000 00ff00 0000ff # scroll palm thumb
|
||||||
python rat8.py breathe ff00ff -p 3
|
python rat8.py breathe ff00ff -p 3
|
||||||
python rat8.py off
|
python rat8.py off
|
||||||
python rat8.py restore profile_backup.json
|
python rat8.py restore profile_backup.json
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ HID feature reports, padded to 2053 bytes:
|
|||||||
read reply [5, B0, slot, checksum, 733 bytes]
|
read reply [5, B0, slot, checksum, 733 bytes]
|
||||||
|
|
||||||
LED block: 3 zones of 191 bytes starting at profile offset 160.
|
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]
|
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]
|
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
|
PROFILE_LEN = 733
|
||||||
LED_OFFSET = 160
|
LED_OFFSET = 160
|
||||||
LED_ZONE_LEN = 191
|
LED_ZONE_LEN = 191
|
||||||
ZONES = {"scroll": 0, "palm": 1, "dpi": 2}
|
ZONES = {"scroll": 0, "palm": 1, "thumb": 2}
|
||||||
|
|
||||||
|
|
||||||
def checksum(data):
|
def checksum(data):
|
||||||
@@ -129,8 +129,8 @@ def zone_colors(args):
|
|||||||
if len(cols) == 1:
|
if len(cols) == 1:
|
||||||
return {z: cols[0] for z in range(3)}
|
return {z: cols[0] for z in range(3)}
|
||||||
if len(cols) == 3:
|
if len(cols) == 3:
|
||||||
return {ZONES["scroll"]: cols[0], ZONES["palm"]: cols[1], ZONES["dpi"]: cols[2]}
|
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 dpi)")
|
raise SystemExit("give 1 colour (all zones) or 3 colours (scroll palm thumb)")
|
||||||
|
|
||||||
|
|
||||||
def apply(m, args, build):
|
def apply(m, args, build):
|
||||||
@@ -152,14 +152,14 @@ def main():
|
|||||||
for name, hlp in (("static", "solid colours"), ("breathe", "breathing effect")):
|
for name, hlp in (("static", "solid colours"), ("breathe", "breathing effect")):
|
||||||
sp = sub.add_parser(name, help=hlp)
|
sp = sub.add_parser(name, help=hlp)
|
||||||
sp.add_argument("colors", nargs="+", type=parse_color,
|
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("-b", "--brightness", type=int, default=255)
|
||||||
sp.add_argument("--all-slots", action="store_true", help="write all 4 profiles, not just the active one")
|
sp.add_argument("--all-slots", action="store_true", help="write all 4 profiles, not just the active one")
|
||||||
if name == "breathe":
|
if name == "breathe":
|
||||||
sp.add_argument("-p", "--period", type=int, default=3, help="seconds per breath")
|
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 = 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")
|
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")
|
sp = sub.add_parser("off", help="turn all LEDs off")
|
||||||
|
|||||||
Reference in new issue
Block a user