mirror of
https://github.com/stagehacks/Cue-View.git
synced 2026-08-08 07:13:39 +00:00
Define variables before use
This commit is contained in:
+42
-42
@@ -20,48 +20,6 @@ exports.ready = function (device) {
|
||||
};
|
||||
let password = false;
|
||||
|
||||
exports.data = function (device, message) {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
const msg = message.toString();
|
||||
|
||||
if (msg.substring(0, 8) == 'PJLINK 1') {
|
||||
password = md5(`${msg.substring(9, 17)}JBMIAProjectorLink`);
|
||||
device.send(
|
||||
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
|
||||
);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1POWR=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INPT=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1AVMT=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1ERST=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1LAMP=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1NAME=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INF1=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INF2=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%2SNUM=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%2SVER=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
};
|
||||
|
||||
function processPJLink(device, str, that) {
|
||||
const arr = str.split('%');
|
||||
for (var key in arr) {
|
||||
@@ -111,6 +69,48 @@ function processPJLink(device, str, that) {
|
||||
device.draw();
|
||||
}
|
||||
|
||||
exports.data = function (device, message) {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
const msg = message.toString();
|
||||
|
||||
if (msg.substring(0, 8) == 'PJLINK 1') {
|
||||
password = md5(`${msg.substring(9, 17)}JBMIAProjectorLink`);
|
||||
device.send(
|
||||
`${password}%1POWR ?\r%1INPT ?\r%1AVMT ?\r%1ERST ?\r%1LAMP ?\r%1NAME ?\r%1INF1 ?\r%1INF2 ?\r%2SNUM ?\r%2SVER ?\r`
|
||||
);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1POWR=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INPT=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1AVMT=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1ERST=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1LAMP=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1NAME=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INF1=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%1INF2=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%2SNUM=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
if (msg.substring(0, 7) == '%2SVER=') {
|
||||
processPJLink(device, msg, this);
|
||||
}
|
||||
};
|
||||
|
||||
exports.heartbeat = function (device) {
|
||||
if (password) {
|
||||
device.send(
|
||||
|
||||
@@ -45,8 +45,6 @@ exports.data = function (device, osc) {
|
||||
device.data.workspaces[workspace].cueLists[d[i].uniqueID].cues =
|
||||
d[i].cues;
|
||||
|
||||
getMoreCueInfo(d[i], []);
|
||||
|
||||
function getMoreCueInfo(group, groups_arg) {
|
||||
const groups = JSON.parse(JSON.stringify(groups_arg));
|
||||
groups.push(group.uniqueID);
|
||||
@@ -79,6 +77,8 @@ exports.data = function (device, osc) {
|
||||
device.data.workspaces[workspace].allCues[cue.uniqueID] = cue;
|
||||
}
|
||||
}
|
||||
|
||||
getMoreCueInfo(d[i], []);
|
||||
}
|
||||
|
||||
// console.log(device.data.lastCueInGroup)
|
||||
|
||||
+18
-18
@@ -31,6 +31,24 @@ exports.ready = function (device) {
|
||||
// device.send(Buffer.from("/subscribe\x00,si\x00/-stat/solosw/01\x001"));
|
||||
};
|
||||
|
||||
function parseAddress(msg) {
|
||||
const addr = msg.split('/');
|
||||
addr.shift();
|
||||
return addr;
|
||||
}
|
||||
|
||||
function convertToDBTheBehringerWay(f) {
|
||||
if (f >= 0.5) {
|
||||
return f * 40 - 30;
|
||||
} else if (f >= 0.25) {
|
||||
return f * 80 - 50;
|
||||
} else if (f >= 0.0625) {
|
||||
return f * 160 - 70;
|
||||
} else {
|
||||
return f * 480 - 90;
|
||||
}
|
||||
}
|
||||
|
||||
exports.data = function (device, buf) {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
const msg = buf.toString().split('\u0000\u0000');
|
||||
@@ -110,21 +128,3 @@ exports.data = function (device, buf) {
|
||||
exports.heartbeat = function (device) {
|
||||
device.send(Buffer.from('/xremote'));
|
||||
};
|
||||
|
||||
function parseAddress(msg) {
|
||||
const addr = msg.split('/');
|
||||
addr.shift();
|
||||
return addr;
|
||||
}
|
||||
|
||||
function convertToDBTheBehringerWay(f) {
|
||||
if (f >= 0.5) {
|
||||
return f * 40 - 30;
|
||||
} else if (f >= 0.25) {
|
||||
return f * 80 - 50;
|
||||
} else if (f >= 0.0625) {
|
||||
return f * 160 - 70;
|
||||
} else {
|
||||
return f * 480 - 90;
|
||||
}
|
||||
}
|
||||
|
||||
+18
-18
@@ -31,6 +31,24 @@ exports.ready = function (device) {
|
||||
// device.send(Buffer.from("/subscribe\x00,si\x00/-stat/solosw/01\x001"));
|
||||
};
|
||||
|
||||
function parseAddress(msg) {
|
||||
const addr = msg.split('/');
|
||||
addr.shift();
|
||||
return addr;
|
||||
}
|
||||
|
||||
function convertToDBTheBehringerWay(f) {
|
||||
if (f >= 0.5) {
|
||||
return f * 40 - 30;
|
||||
} else if (f >= 0.25) {
|
||||
return f * 80 - 50;
|
||||
} else if (f >= 0.0625) {
|
||||
return f * 160 - 70;
|
||||
} else {
|
||||
return f * 480 - 90;
|
||||
}
|
||||
}
|
||||
|
||||
exports.data = function (device, buf) {
|
||||
this.deviceInfoUpdate(device, 'status', 'ok');
|
||||
const msg = buf.toString().split('\u0000');
|
||||
@@ -115,21 +133,3 @@ exports.data = function (device, buf) {
|
||||
exports.heartbeat = function (device) {
|
||||
device.send(Buffer.from('/xremote'));
|
||||
};
|
||||
|
||||
function parseAddress(msg) {
|
||||
const addr = msg.split('/');
|
||||
addr.shift();
|
||||
return addr;
|
||||
}
|
||||
|
||||
function convertToDBTheBehringerWay(f) {
|
||||
if (f >= 0.5) {
|
||||
return f * 40 - 30;
|
||||
} else if (f >= 0.25) {
|
||||
return f * 80 - 50;
|
||||
} else if (f >= 0.0625) {
|
||||
return f * 160 - 70;
|
||||
} else {
|
||||
return f * 480 - 90;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user