Corsair_Virtuoso_XT_Headset.js.bad aktualisiert
This commit is contained in:
parent
c29910d2e0
commit
816f94ffc5
@ -3,7 +3,7 @@ export function VendorId() { return 0x1b1c; }
|
||||
export function ProductId() { return 0x0A64; }
|
||||
export function Publisher() { return "WhirlwindFX"; }
|
||||
export function Documentation(){ return "troubleshooting/corsair"; }
|
||||
export function Size() { return [1, 1]; }
|
||||
export function Size() { return [1, 2]; }
|
||||
export function DefaultPosition(){return [145, 85];}
|
||||
export function DefaultScale(){return 10.0;}
|
||||
/* global
|
||||
@ -28,7 +28,7 @@ let device_status;
|
||||
let previousBatteryLevel = -1;
|
||||
let batteryPercentage = -1;
|
||||
|
||||
const vLeds = [ 0, 1 ]
|
||||
const vLeds = [ 0, 1 ];
|
||||
|
||||
const vLedNames = [
|
||||
"Logo", "Mic"
|
||||
@ -51,7 +51,7 @@ export function Initialize() {
|
||||
headsetMode = (ProductId() == 0x0a6b || ProductId() == 0x0a64) ? 0x09 : 0x08;
|
||||
device.addFeature("battery");
|
||||
setSoftwareMode();
|
||||
setMicOn()
|
||||
setMicOn();
|
||||
setSidetone();
|
||||
setIdleTimeout(idleTimeoutLength);
|
||||
}
|
||||
@ -76,8 +76,8 @@ export function onSidetoneAmountChanged() {
|
||||
|
||||
export function onidleTimeoutLengthChanged() {
|
||||
if (idleTimeout){
|
||||
console.log ("Set Idle Timeout to: " + idleTimeoutLength + "Minutes")
|
||||
setIdleTimeout(idleTimeoutLength)
|
||||
console.log ("Set Idle Timeout to: " + idleTimeoutLength + "Minutes");
|
||||
setIdleTimeout(idleTimeoutLength);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,11 +110,12 @@ function sendColors(overrideColor) {
|
||||
}
|
||||
|
||||
device.set_endpoint(3, 0x0001, 0xFF42);
|
||||
device.write(packet, 64);
|
||||
device.write(packet.concat(RGBData), 64);
|
||||
}
|
||||
|
||||
function setSidetone() {
|
||||
device.set_endpoint(3, 0x0001, 0xFF42);
|
||||
|
||||
const packet = [];
|
||||
// Header
|
||||
packet[0] = 0x02;
|
||||
@ -122,7 +123,7 @@ function setSidetone() {
|
||||
packet[2] = 0x01;
|
||||
packet[3] = 0x47;
|
||||
|
||||
let sidetoneValue = Math.round((SidetoneAmount / 100) * 1000);
|
||||
const sidetoneValue = Math.round((SidetoneAmount / 100) * 1000);
|
||||
|
||||
packet[0x05] = sidetoneValue & 0xFF;
|
||||
packet[0x06] = (sidetoneValue >> 8) & 0xFF;
|
||||
@ -134,7 +135,7 @@ export function onidleTimeoutChanged() {
|
||||
device.set_endpoint(3, 0x0001, 0xFF42);
|
||||
device.write([0x02, headsetMode, 0x01, 0x0d, 0x01], 128);
|
||||
device.pause(1);
|
||||
setIdleTimeout(idleTimeoutLength)
|
||||
setIdleTimeout(idleTimeoutLength);
|
||||
}else{
|
||||
device.set_endpoint(3, 0x0001, 0xFF42);
|
||||
device.write([0x02, headsetMode, 0x01, 0x0d], 128);
|
||||
@ -154,6 +155,7 @@ function setSoftwareMode() {
|
||||
|
||||
function readDevice() {
|
||||
device.set_endpoint(3, 0x0002, 0xFF42);
|
||||
|
||||
const packet = device.read([0x00], 16, 15);
|
||||
|
||||
if(packet[0] == 0x03 && packet[1] == 0x01 && packet[2] == 0x01 && packet[3] == 0x10 && packet[4] == 0x00 && packet[5] == 0x02) {
|
||||
@ -161,24 +163,27 @@ function readDevice() {
|
||||
}
|
||||
|
||||
if(packet[0] == 0x03 && packet[2] == 0x01 && packet[3] == 0x46 && packet[4] == 0x00 && packet[5] == 0x00) {
|
||||
console.log("Microphone: ON")
|
||||
console.log("Microphone: ON");
|
||||
}
|
||||
|
||||
if(packet[0] == 0x03 && packet[2] == 0x01 && packet[3] == 0x46 && packet[4] == 0x00 && packet[5] == 0x01) {
|
||||
console.log("Microphone: OFF")
|
||||
console.log("Microphone: OFF");
|
||||
}
|
||||
|
||||
if(packet[0] == 0x03 && packet[2] == 0x01 && packet[3] == 0x10 && packet[4] == 0x00 && packet[5] == 0x01) {
|
||||
battery.setBatteryState(2)
|
||||
console.log("Headset is charging")
|
||||
battery.setBatteryState(2);
|
||||
console.log("Headset is charging");
|
||||
}
|
||||
|
||||
if(packet[0] == 0x03 && packet[2] == 0x01 && packet[3] == 0x10 && packet[4] == 0x00 && packet[5] == 0x02) {
|
||||
battery.setBatteryState(1)
|
||||
console.log("Headset is draining")
|
||||
battery.setBatteryState(1);
|
||||
console.log("Headset is draining");
|
||||
}
|
||||
|
||||
if (packet[0] == 0x03 && packet[1] == 0x01 && packet[2] == 0x01 && packet[3] == 0x0f && packet[4] == 0x00) {
|
||||
|
||||
let batteryValue = (packet[5] & 0xFF) | ((packet[6] & 0xFF) << 8);
|
||||
let maxBatteryValue = 1023; // 0xff03 in Dezimal
|
||||
const batteryValue = (packet[5] & 0xFF) | ((packet[6] & 0xFF) << 8);
|
||||
const maxBatteryValue = 1023; // 0xff03 in Dezimal
|
||||
|
||||
batteryPercentage = Math.round((batteryValue / maxBatteryValue) * 100);
|
||||
|
||||
@ -194,6 +199,7 @@ function readDevice() {
|
||||
battery.setBatteryState(2);
|
||||
}
|
||||
}
|
||||
|
||||
previousBatteryLevel = batteryPercentage;
|
||||
}
|
||||
}
|
||||
@ -205,8 +211,8 @@ function setMicOn() {
|
||||
}
|
||||
|
||||
function setIdleTimeout(idleTimeoutLength) {
|
||||
applyPreConfig()
|
||||
applyIdleTimeout(idleTimeoutLength)
|
||||
applyPreConfig();
|
||||
applyIdleTimeout(idleTimeoutLength);
|
||||
}
|
||||
|
||||
function applyIdleTimeout(idleTimeoutLength) {
|
||||
@ -225,7 +231,7 @@ function applyIdleTimeout(idleTimeoutLength) {
|
||||
packet[5] = parseInt(littleEndianHex[0], 16);
|
||||
packet[6] = parseInt(littleEndianHex[1], 16);
|
||||
packet[7] = parseInt(littleEndianHex[2], 16);
|
||||
console.log ("Idle Timeout: " + idleTimeoutLength + "Min")
|
||||
console.log ("Idle Timeout: " + idleTimeoutLength + "Min");
|
||||
device.write(packet, 128);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user