Skip to content

Commit

Permalink
0bpm "fix"
Browse files Browse the repository at this point in the history
Now, if your smartwatch/fitness tracker reports 0bpm - app will ignore it. (Useful for those devices which sometimes sends 0bpm)
  • Loading branch information
Vard committed Feb 27, 2022
1 parent b77b2d0 commit 50e6ad9
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ console.log("Waiting for connection from browser...");
server.on('connection', ws => {
console.log("Connected. Waiting for data...");
ws.on('message', function message(data) {
console.log('Got heart rate: %s bpm', data);
let heartrate = {
address: "/avatar/parameters/Heartrate",
args:
{
type: "f",
value: data/127-1
}
};
vrchatOSC.send(heartrate);
});
})
if (data == 0) {
console.log("Got heart rate: 0 bpm, skipping parameter update...");
} else {
console.log('Got heart rate: %s bpm', data);
let heartrate = {
address: "/avatar/parameters/Heartrate",
args:
{
type: "f",
value: data/127-1
}
};
vrchatOSC.send(heartrate);
}
});
});

0 comments on commit 50e6ad9

Please sign in to comment.