Lepsi serial debug

kegel
Jurij Podgoršek 2022-06-17 16:10:59 +02:00
parent c5d19367f8
commit 5be48cffe7
1 changed files with 13 additions and 1 deletions

View File

@ -49,6 +49,18 @@ const include_files = [
'/node_modules/osc/dist/osc-browser.js'
];
function isFloat(value) {
if (
typeof value === 'number' &&
!Number.isNaN(value) &&
!Number.isInteger(value)
) {
return true;
}
return false;
}
const app = express();
const server = http.Server(app);
@ -97,7 +109,7 @@ function openSerial(ttyAddr) {
// Debug incoming serial osc
if (DEBUG.osc) {
console.log('osc SERIAL msg', msg, ttyAddr, prepend)
console.log('osc SERIAL msg', msg.address, msg.args.map((a) => isFloat(a) ? a.toFixed(3) : a), ttyAddr, prepend)
}
sendAll(msg, null, null, osclients, prepend)
})