mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
be webel
This commit is contained in:
@@ -275,6 +275,13 @@ function broadcastLidarScan(payload) {
|
||||
}
|
||||
}
|
||||
|
||||
function broadcastLidarLine(payload) {
|
||||
for (const socket of io.sockets.sockets.values()) {
|
||||
if (!isVerified(socket)) continue;
|
||||
socket.volatile.emit('neato:lidarLine', payload);
|
||||
}
|
||||
}
|
||||
|
||||
lidarRuntime =
|
||||
brainslugHost && brainslugKey
|
||||
? createLidarRuntime({
|
||||
@@ -292,6 +299,9 @@ if (lidarRuntime) {
|
||||
lidarRuntime.on('scan', (payload) => {
|
||||
broadcastLidarScan(payload);
|
||||
});
|
||||
lidarRuntime.on('line', (payload) => {
|
||||
broadcastLidarLine(payload);
|
||||
});
|
||||
lidarRuntime.on('status', () => {
|
||||
emitUpdate();
|
||||
});
|
||||
|
||||
@@ -212,6 +212,10 @@ function createLidarRuntime({ logger, host, port = 6053, key, logFile = '', shou
|
||||
const lines = state[bufferKey].split(/\r?\n/);
|
||||
state[bufferKey] = lines.pop() || '';
|
||||
for (const line of lines) {
|
||||
events.emit('line', {
|
||||
source: sourceLabel || 'unknown',
|
||||
line: sanitizeLogText(line),
|
||||
});
|
||||
const payload = parsePayloadFromLine(line);
|
||||
handlePayload(payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user