clean up null characters

This commit is contained in:
2022-02-17 19:37:58 -06:00
parent 13d7cbd718
commit 5f4c544e99
+7 -10
View File
@@ -28,7 +28,6 @@ exports.ready = function ready(device) {
// device.send(Buffer.from("\x2f\x62\x61\x74\x63\x68\x73\x75\x62\x73\x63\x72\x69\x62\x65\x00\x2c\x73\x73\x69\x69\x69\x00\x00\x6d\x65\x74\x65\x72\x73\x2f\x30\x00\x00\x00\x00\x2f\x6d\x65\x74\x65\x72\x73\x2f\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"));
// device.send(Buffer.from("/batchsubscribe\x00,ssiii\x00\x00meters/0\x00\x00\x00\x00/meters/0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"));
// device.send(Buffer.from("/subscribe\x00,si\x00/-stat/solosw/01\x001"));
};
@@ -53,7 +52,7 @@ function convertToDBTheBehringerWay(f) {
exports.data = function data(device, buf) {
this.deviceInfoUpdate(device, 'status', 'ok');
const msg = buf.toString().split('\u0000');
const msg = buf.toString().split('\x00');
const d = device;
if (msg[0] === '/xinfo') {
@@ -68,15 +67,13 @@ exports.data = function data(device, buf) {
d.data.model = msg[9];
this.deviceInfoUpdate(d, 'defaultName', d.data.name);
d.send('/lr/mix/fader\u0000\u0000\u0000\u0000');
d.send('/lr/mix/on\u0000\u0000\u0000\u0000');
d.send('/lr/mix/fader\x00\x00\x00\x00');
d.send('/lr/mix/on\x00\x00\x00\x00');
for (let i = 0; i <= 32; i++) {
d.send(
Buffer.from(
`/ch/${i
.toString()
.padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000`
`/ch/${i.toString().padStart(2, '0')}/config/name\x00\x00\x00\x00`
)
);
}
@@ -108,19 +105,19 @@ exports.data = function data(device, buf) {
d.data.stereoMute = buf[19];
}
device.draw();
device.send(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`);
device.send(`/ch/${addr[1]}/mix/fader\x00\x00\x00\x00`);
} else if (msg[0].indexOf('/config/name') > 0) {
const addr = parseAddress(msg[0]);
const channel = Number(addr[1]);
d.data.channelNames[channel - 1] = msg[4];
d.draw();
d.send(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`);
d.send(`/ch/${addr[1]}/config/color\x00\x00\x00\x00`);
} else if (msg[0].indexOf('/config/color') > 0) {
const addr = parseAddress(msg[0]);
const channel = Number(addr[1]);
d.data.channelColors[channel - 1] = buf.readInt8(27);
d.draw();
d.send(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`);
d.send(`/ch/${addr[1]}/mix/on\x00\x00\x00\x00`);
} else {
// console.log(msg)
}