add GPIO 4 emergency pause

This commit is contained in:
Todd Treece 2017-03-04 21:08:42 +00:00
parent f50318b34c
commit c85748ff0b
2 changed files with 12 additions and 4 deletions

3
cli
View file

@ -19,8 +19,7 @@ function start() {
pm2.start({
script: path.join(__dirname,'index.js'),
name: 'xcarve',
cwd: process.cwd()
name: 'xcarve'
}, (err, apps) => {
pm2.disconnect();
if (err) throw err

View file

@ -1,12 +1,16 @@
// this file is part of the v0.2.7 easel local OS X install.
// you can find out more about easel and the x-carve at
// inventables.com & easel.inventables.com
var Machine = require('./machine')
, SerialPortController = require('./serial_port_controller')
, path = require('path')
, Debugger = require('./debugger')
, power = require('onoff').Gpio(17, 'out') , fs = require('fs'); var WebsocketController = function(sockets, version, abilities) { var that = {};
, power = require('onoff').Gpio(17, 'out')
, estop = require('onoff').Gpio(4, 'in', 'both')
, fs = require('fs');
var WebsocketController = function(sockets, version, abilities) {
var that = {};
var logger = Debugger.logger("Websocket Controller");
var connectedClients = 0;
var serialPortController = new SerialPortController();
@ -232,6 +236,11 @@ var Machine = require('./machine')
echoEnabled = enabled;
};
estop.watch(function (err, value) {
if(err || !value)
machine.pause();
});
sockets.on('connection', function(socket) {
// turn on powerswitchtail