From 338b80fb06d907bd551c55201eec65dbe41bcb47 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Wed, 14 Nov 2018 12:47:25 -0800 Subject: [PATCH] Update DMXKingUltraDMXPro Driver's Buffer API (#63) --- drivers/dmxking-ultra-dmx-pro.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/dmxking-ultra-dmx-pro.js b/drivers/dmxking-ultra-dmx-pro.js index a4e32ef..cc78c15 100644 --- a/drivers/dmxking-ultra-dmx-pro.js +++ b/drivers/dmxking-ultra-dmx-pro.js @@ -14,8 +14,7 @@ var DMXKING_ULTRA_DMX_PRO_DMX_STARTCODE = 0x00 function DMXKingUltraDMXPro(device_id, options) { var self = this this.options = options || {} - this.universe = new Buffer(513) - this.universe.fill(0) + this.universe = Buffer.alloc(513, 0); this.sendDMXReq = DMXKING_ULTRA_DMX_PRO_SEND_DMX_RQ if (this.options.port === "A") { @@ -40,7 +39,7 @@ DMXKingUltraDMXPro.prototype.send_universe = function() { if(!this.dev.writable) { return } - var hdr = Buffer([ + var hdr = Buffer.from([ DMXKING_ULTRA_DMX_PRO_START_OF_MSG, this.sendDMXReq, (this.universe.length) & 0xff, @@ -51,7 +50,7 @@ DMXKingUltraDMXPro.prototype.send_universe = function() { var msg = Buffer.concat([ hdr, this.universe.slice(1), - Buffer([DMXKING_ULTRA_DMX_PRO_END_OF_MSG]) + Buffer.from([DMXKING_ULTRA_DMX_PRO_END_OF_MSG]) ]) this.dev.write(msg) }