Compare commits
2 Commits
251efac204
...
c63c329521
Author | SHA1 | Date |
---|---|---|
|
c63c329521 | |
|
ae2e8d093d |
|
@ -1 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.~*~
|
||||||
|
.*~undo-tree~
|
||||||
|
.~lock*#
|
||||||
|
.*.swp
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,13 +4,13 @@
|
||||||
"description": "epilepsija",
|
"description": "epilepsija",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"midi": "^2.0.0",
|
||||||
"nodemon": "^2.0.12",
|
"nodemon": "^2.0.12",
|
||||||
"nouislider": "14.6.2",
|
"nouislider": "14.6.2",
|
||||||
"osc": "^2.4.2",
|
"osc": "^2.4.2",
|
||||||
"pm2": "^5.1.0",
|
"pm2": "^5.1.0",
|
||||||
"three": "0.135.0",
|
"three": "0.135.0",
|
||||||
"ws": "^7.3.1",
|
"ws": "^7.3.1"
|
||||||
"hydra-osc": "dev-master"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npx nodemon server.js /dev/ttyUSB0"
|
"start": "npx nodemon server.js /dev/ttyUSB0"
|
||||||
|
|
|
@ -21,6 +21,10 @@ const WebSocket = require('ws')
|
||||||
const osc = require('osc')
|
const osc = require('osc')
|
||||||
const readline = require('readline')
|
const readline = require('readline')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const midi = require('midi')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Vzemi iz argumenta
|
// Vzemi iz argumenta
|
||||||
const tty = process.argv[2]
|
const tty = process.argv[2]
|
||||||
|
|
||||||
|
@ -57,7 +61,6 @@ function openSerial() {
|
||||||
autoOpen: true,
|
autoOpen: true,
|
||||||
useSLIP: true
|
useSLIP: true
|
||||||
})
|
})
|
||||||
scon.open()
|
|
||||||
|
|
||||||
scon.on('open', e => {
|
scon.on('open', e => {
|
||||||
console.log('serial connection opened')
|
console.log('serial connection opened')
|
||||||
|
@ -69,6 +72,7 @@ function openSerial() {
|
||||||
})
|
})
|
||||||
scon.on('close', e => {
|
scon.on('close', e => {
|
||||||
console.warn('serial connection closed, restarting in 1 second')
|
console.warn('serial connection closed, restarting in 1 second')
|
||||||
|
setTimeout(openSerial, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Arduino OSC gre v web
|
// Arduino OSC gre v web
|
||||||
|
@ -81,6 +85,8 @@ function openSerial() {
|
||||||
sendAll(msg, null, null, osclients)
|
sendAll(msg, null, null, osclients)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
scon.open()
|
||||||
|
|
||||||
if (scon._closeCode) {
|
if (scon._closeCode) {
|
||||||
scon = null
|
scon = null
|
||||||
console.log('restarting serial connection')
|
console.log('restarting serial connection')
|
||||||
|
|
Loading…
Reference in New Issue