Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
writes a new robot.extra when new data arrives instead of when sigint
Browse files Browse the repository at this point in the history
happens
  • Loading branch information
rush2sk8 committed Jul 9, 2018
1 parent de6da73 commit 9ec5a45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion streamdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ io.sockets.on('connection', (socket) => {
if (enable_logging)
robotstream.write("X, Y, Z, RX, RY, RZ," + extraRobotData.toString() + "\n");

if (extraRobotData.length >= 1) {
fs.writeFileSync("robot.extra", extraRobotData)
}

//emit this to the main page so that you can keep the additional data persistent
setTimeout(() => {
io.sockets.emit('add_labels', { data: extraRobotData.toString() });
Expand All @@ -360,7 +364,7 @@ io.sockets.on('connection', (socket) => {

//if they request the additional dat labels then send them what we have
socket.on('request_labels', (d) => {
io.sockets.emit('add_labels', { data: extraRobotData.toString() });
io.sockets.emit('add_labels', { data: extraRobotData.toString() });
})
});

Expand Down

0 comments on commit 9ec5a45

Please sign in to comment.