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:
1 parent
25f3e31b8f
commit
f4eb036a98
3 files changed
+35
-16
No files matched your search
+25
-8
@@ -19,21 +19,36 @@ LightingMode:readonly
|
||||
forcedColor:readonly
|
||||
shutdownMode:readonly
|
||||
shutdownColor:readonly
|
||||
colorCorrection:readonly
|
||||
whiteBalance:readonly
|
||||
*/
|
||||
export function ControllableParameters() {
|
||||
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:"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:"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"},
|
||||
];
|
||||
}
|
||||
|
||||
// Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = DPI button
|
||||
const vLedNames = ["Scroll Wheel", "DPI Button", "Palm Logo"];
|
||||
const vLedPositions = [[1, 0], [1, 1], [1, 2]];
|
||||
// Zones: 0 = under the scroll wheel, 1 = palm logo, 2 = under the thumb wheel (left side)
|
||||
const vLedNames = ["Scroll Wheel", "Thumb Wheel", "Palm Logo"];
|
||||
const vLedPositions = [[1, 0], [0, 1], [1, 2]];
|
||||
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;
|
||||
const k = whiteBalance === "Off" ? [1, 1, 1] : ZONE_BALANCE[zone];
|
||||
return c.map((v, i) => Math.round(255 * Math.pow(v / 255, g) * k[i]));
|
||||
}
|
||||
|
||||
const FEAT_LEN = 2053;
|
||||
const PROFILE_LEN = 733;
|
||||
const LED_OFFSET = 160;
|
||||
@@ -98,8 +113,9 @@ export function Shutdown(SystemSuspending) {
|
||||
}
|
||||
|
||||
function setZone(zone, c) {
|
||||
device.send_report([12, 0xC4, 3, 4, 1, zone, c[0], c[1], c[2]], FEAT_LEN);
|
||||
sent[zone] = c;
|
||||
const o = corrected(c, zone);
|
||||
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() {
|
||||
@@ -158,9 +174,10 @@ function saveToProfile(colors) {
|
||||
const o = LED_OFFSET + z * LED_ZONE_LEN;
|
||||
profile[o] = 1; // static
|
||||
profile[o + 1] = 255; // brightness
|
||||
profile[o + 2] = colors[z][0];
|
||||
profile[o + 3] = colors[z][1];
|
||||
profile[o + 4] = colors[z][2];
|
||||
const c = corrected(colors[z], z);
|
||||
profile[o + 2] = c[0];
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user