logi-fix.js aktualisiert
This commit is contained in:
parent
bda888d41c
commit
8a8eda46eb
75
logi-fix.js
75
logi-fix.js
@ -73,6 +73,43 @@ export function Render(){
|
||||
//applyExtra();
|
||||
}
|
||||
|
||||
function SendGkeys(overrideColor) {
|
||||
const packet = [];
|
||||
packet[0] = 0x12;
|
||||
packet[1] = 0xFF;
|
||||
packet[2] = 0x0F;
|
||||
packet[3] = 0x3F;
|
||||
packet[4] = 0x00;
|
||||
packet[5] = 4;
|
||||
packet[6] = 0x00;
|
||||
packet[7] = 9; // led count
|
||||
|
||||
for(let iIdx = 0; iIdx < vGkeyPositions.length; iIdx++){
|
||||
const iLedIdx = (iIdx * 4) + 8;
|
||||
const iKeyPosX = vGkeyPositions[iIdx][0];
|
||||
const iKeyPosY = vGkeyPositions[iIdx][1];
|
||||
var color;
|
||||
|
||||
if(overrideColor){
|
||||
color = hexToRgb(overrideColor);
|
||||
}else if (LightingMode === "Forced") {
|
||||
color = hexToRgb(forcedColor);
|
||||
}else{
|
||||
color = device.color(iKeyPosX, iKeyPosY);
|
||||
}
|
||||
|
||||
packet[iLedIdx] = iIdx;
|
||||
packet[iLedIdx+1] = color[0];
|
||||
packet[iLedIdx+2] = color[1];
|
||||
packet[iLedIdx+3] = color[2];
|
||||
}
|
||||
|
||||
|
||||
device.set_endpoint(1, 0x0604, 0xff43); // Lighting IF
|
||||
device.write(packet, 64);
|
||||
device.pause(1);
|
||||
}
|
||||
|
||||
export function Shutdown(SystemSuspending) {
|
||||
const color = SystemSuspending ? "#000000" : shutdownColor;
|
||||
sendColors(color);
|
||||
@ -130,49 +167,11 @@ function sendColors(overrideColor) {
|
||||
packet = [0x11, 0xFF, 0x10, 0x1F].concat(RGBDataExtra.splice(0, ledsToSend*4));
|
||||
//packet = [0x11, 0xFF, 0x08, 0x20].concat(RGBDataExtra.splice(0, ledsToSend*4));
|
||||
|
||||
|
||||
device.set_endpoint(1, 0x0602, 0xff43); // System IF
|
||||
device.write(packet, 20);
|
||||
device.pause(1);
|
||||
|
||||
|
||||
const packet1 = [];
|
||||
packet1[0] = 0x12;
|
||||
packet1[1] = 0xFF;
|
||||
packet1[2] = 0x0F;
|
||||
packet1[3] = 0x3F;
|
||||
packet1[4] = 0x00;
|
||||
packet1[5] = 4;
|
||||
packet1[6] = 0x00;
|
||||
packet1[7] = 9; // led count
|
||||
|
||||
for(let iIdx = 0; iIdx < vGkeyPositions.length; iIdx++){
|
||||
const iLedIdx = (iIdx * 4) + 8;
|
||||
const iKeyPosX = vGkeyPositions[iIdx][0];
|
||||
const iKeyPosY = vGkeyPositions[iIdx][1];
|
||||
var color;
|
||||
|
||||
if(overrideColor){
|
||||
color = hexToRgb(overrideColor);
|
||||
}else if (LightingMode === "Forced") {
|
||||
color = hexToRgb(forcedColor);
|
||||
}else{
|
||||
color = device.color(iKeyPosX, iKeyPosY);
|
||||
}
|
||||
|
||||
packet1[iLedIdx] = iIdx;
|
||||
packet1[iLedIdx+1] = color[0];
|
||||
packet1[iLedIdx+2] = color[1];
|
||||
packet1[iLedIdx+3] = color[2];
|
||||
}
|
||||
|
||||
|
||||
device.set_endpoint(1, 0x0604, 0xff43); // Lighting IF
|
||||
device.write(packet1, 20);
|
||||
device.pause(1);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user