Update DMXKingUltraDMXPro Driver's Buffer API (#63)
This commit is contained in:
parent
8499aa5829
commit
338b80fb06
1 changed files with 3 additions and 4 deletions
|
@ -14,8 +14,7 @@ var DMXKING_ULTRA_DMX_PRO_DMX_STARTCODE = 0x00
|
||||||
function DMXKingUltraDMXPro(device_id, options) {
|
function DMXKingUltraDMXPro(device_id, options) {
|
||||||
var self = this
|
var self = this
|
||||||
this.options = options || {}
|
this.options = options || {}
|
||||||
this.universe = new Buffer(513)
|
this.universe = Buffer.alloc(513, 0);
|
||||||
this.universe.fill(0)
|
|
||||||
|
|
||||||
this.sendDMXReq = DMXKING_ULTRA_DMX_PRO_SEND_DMX_RQ
|
this.sendDMXReq = DMXKING_ULTRA_DMX_PRO_SEND_DMX_RQ
|
||||||
if (this.options.port === "A") {
|
if (this.options.port === "A") {
|
||||||
|
@ -40,7 +39,7 @@ DMXKingUltraDMXPro.prototype.send_universe = function() {
|
||||||
if(!this.dev.writable) {
|
if(!this.dev.writable) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var hdr = Buffer([
|
var hdr = Buffer.from([
|
||||||
DMXKING_ULTRA_DMX_PRO_START_OF_MSG,
|
DMXKING_ULTRA_DMX_PRO_START_OF_MSG,
|
||||||
this.sendDMXReq,
|
this.sendDMXReq,
|
||||||
(this.universe.length) & 0xff,
|
(this.universe.length) & 0xff,
|
||||||
|
@ -51,7 +50,7 @@ DMXKingUltraDMXPro.prototype.send_universe = function() {
|
||||||
var msg = Buffer.concat([
|
var msg = Buffer.concat([
|
||||||
hdr,
|
hdr,
|
||||||
this.universe.slice(1),
|
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)
|
this.dev.write(msg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue