Define variables before use

This commit is contained in:
Sam Schloegel
2022-01-05 21:27:38 -05:00
parent 9c16c9c220
commit 0e97bd6abc
7 changed files with 172 additions and 173 deletions
+18 -18
View File
@@ -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;
}
}