diff --git a/server.js b/server.js index 3cb93f997169939fe4319fac003c0a68fd3beb75..d108376c2b86fc2c28ad6f59c945fa51d16b7f30 100644 --- a/server.js +++ b/server.js @@ -11,7 +11,7 @@ const app = express(); app.configure(() => { app.set('port', process.env.PORT || 3001); app.use(app.router); - app.use(express.static(path.join(__dirname, 'public'))); + app.use(express.static(path.join(__dirname, 'public.1'))); app.use('/components', express.static(path.join(__dirname, 'components'))); }); @@ -23,17 +23,21 @@ const socket = new faye.Client(`http://localhost:${app.get('port')}/faye`); // get request from socket -> set command to drone socket.subscribe('/drone/move', cmd => { console.log('move', cmd); - if (typeof drone[cmd.action] === "function") - return drone[cmd.action](cmd.speed); + if (cmd.action == "calibrate") { + console.log("calibrate"); + drone[cmd.action](0); + } + else if (typeof drone[cmd.action] === "function") + drone[cmd.action](cmd.speed); }); socket.subscribe('/drone/animate', cmd => { - console.log('animate', cmd); - return drone.animate(cmd.action, cmd.duration); + //console.log('animate', cmd); + // return drone.animate(cmd.action, cmd.duration); }); socket.subscribe('/drone/drone', cmd => { - console.log('drone command: ', cmd); - if (typeof drone[cmd.action] === "function") - return drone[cmd.action](); + //console.log('drone command: ', cmd); + // if (typeof drone[cmd.action] === "function") + // return drone[cmd.action](); }); // start server