From 1265b7e84828136075f3587c6851ff11d37f240f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommi=20Teistel=C3=A4?= Date: Sun, 19 Oct 2014 13:17:27 +0300 Subject: [PATCH] Work around crash in /dev/null testing mode To test effectserver without physical hardware, leave the host device path unconfigured. The web server will still work. --- config.cson | 2 +- lib/enttec.coffee | 8 +++++--- node_modules/.bin/handlebars | 1 - server.coffee | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) delete mode 120000 node_modules/.bin/handlebars diff --git a/config.cson b/config.cson index 96d209e..e96a2f4 100644 --- a/config.cson +++ b/config.cson @@ -7,7 +7,7 @@ # path: "/dev/serial/by-id/usb-FTDI_FT245R_USB_FIFO_ENP9D7H7-if00-port0" # path: "/dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0" # path: "/dev/serial/by-id/usb-FTDI_USB__-__Serial-if00-port0" - path: "/dev/serial/by-id/usb-ENTTEC_DMX_USB_PRO_ENR35XBU-if00-port0" + # path: "/dev/serial/by-id/usb-ENTTEC_DMX_USB_PRO_ENR35XBU-if00-port0" type: "enttec" mapping: light: diff --git a/lib/enttec.coffee b/lib/enttec.coffee index 35de999..0f1e52b 100644 --- a/lib/enttec.coffee +++ b/lib/enttec.coffee @@ -68,8 +68,9 @@ class Enttec @_buffer = new Buffer 517 @reset() @devices = [] - @serial = new SerialPort opts.path, - baudrate: 57600 + if opts.path + @serial = new SerialPort opts.path, + baudrate: 57600 add: (device) -> @@ -115,7 +116,8 @@ class Enttec # dmx packet must always end with 0xe7 @_buffer[@_buffer.length-1] = 0xe7 - @serial.write @_buffer + if @serial + @serial.write @_buffer exports.Enttec = Enttec exports.RGBLight = RGBLight diff --git a/node_modules/.bin/handlebars b/node_modules/.bin/handlebars deleted file mode 120000 index fb7d090..0000000 --- a/node_modules/.bin/handlebars +++ /dev/null @@ -1 +0,0 @@ -../handlebars/bin/handlebars \ No newline at end of file diff --git a/server.coffee b/server.coffee index 52974b2..34c6f65 100644 --- a/server.coffee +++ b/server.coffee @@ -6,6 +6,9 @@ util = require "util" CSON = require "cson" +process.on 'uncaughtException', (err) -> + console.log 'Caught exception' + err + {EffectManager} = require "./lib/effectmanager" {packetParse} = require "./lib/packetparser"