From 6dc9dddd526ed987abebc2d641571c0238233921 Mon Sep 17 00:00:00 2001 From: Patrick Boyd Date: Mon, 9 Jul 2018 17:55:05 -0500 Subject: [PATCH 1/2] EnttecUSBDMXPRO Driver Buffer API Fix (No Polyfill) --- drivers/enttec-usb-dmx-pro.js | 7 +++---- drivers/null.js | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/enttec-usb-dmx-pro.js b/drivers/enttec-usb-dmx-pro.js index 456c6d5..b718be7 100644 --- a/drivers/enttec-usb-dmx-pro.js +++ b/drivers/enttec-usb-dmx-pro.js @@ -12,8 +12,7 @@ var ENTTEC_PRO_DMX_STARTCODE = 0x00 function EnttecUSBDMXPRO(device_id, options) { var self = this options = options || {} - this.universe = new Buffer(513) - this.universe.fill(0) + this.universe = Buffer.alloc(513, 0); this.dev = new SerialPort(device_id, { 'baudRate': 250000, @@ -31,7 +30,7 @@ EnttecUSBDMXPRO.prototype.send_universe = function() { if(!this.dev.writable) { return } - var hdr = Buffer([ + var hdr = Buffer.from([ ENTTEC_PRO_START_OF_MSG, ENTTEC_PRO_SEND_DMX_RQ, (this.universe.length) & 0xff, @@ -42,7 +41,7 @@ EnttecUSBDMXPRO.prototype.send_universe = function() { var msg = Buffer.concat([ hdr, this.universe.slice(1), - Buffer([ENTTEC_PRO_END_OF_MSG]) + Buffer.from([ENTTEC_PRO_END_OF_MSG]) ]) this.dev.write(msg) } diff --git a/drivers/null.js b/drivers/null.js index 7c9ef86..e8daa23 100644 --- a/drivers/null.js +++ b/drivers/null.js @@ -3,8 +3,7 @@ function Null(device_id, options) { var self = this options = options || {} - this.universe = new Buffer(513) - this.universe.fill(0) + this.universe = Buffer.alloc(513, 0); self.start() } @@ -40,4 +39,4 @@ Null.prototype.get = function(c) { return this.universe[c] } -module.exports = Null \ No newline at end of file +module.exports = Null From 60639d52c62210cbe3c40b63cbcdb65fc1d08dbb Mon Sep 17 00:00:00 2001 From: Patrick Boyd Date: Mon, 9 Jul 2018 17:56:53 -0500 Subject: [PATCH 2/2] Add Engine directive --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 186efc7..cd0ab4d 100644 --- a/package.json +++ b/package.json @@ -28,5 +28,8 @@ "name": "MIT", "url": "http://www.opensource.org/licenses/mit-license.php" } - ] + ], + "engines": { + "node": ">=5.1.0" + } }