initial commit

This commit is contained in:
Sebastian Wiedenroth 2012-09-01 14:17:39 +02:00
commit 332b9b8f70
4 changed files with 111 additions and 0 deletions

34
devices.js Normal file
View file

@ -0,0 +1,34 @@
exports.devices = {
'eurolite-led-bar': {
channels: ['ctrl', 'dimmer', 'strobe', 'red0', 'green0', 'blue0', 'red1', 'green1', 'blue1', 'red2', 'green2', 'blue2'],
ranges: {
'ctrl': {
'type': 'option',
'options': [
{'value': 0, 'label': 'Black Out'},
{'value': 1, 'label': 'Dimmer 1'},
{'value': 16, 'label': 'Dimmer 2'},
{'value': 32, 'label': 'Red'},
{'value': 48, 'label': 'Green'},
{'value': 64, 'label': 'Blue'},
{'value': 80, 'label': 'Purple'},
{'value': 96, 'label': 'Yellow'},
{'value': 112, 'label': 'Cyan'},
{'value': 128, 'label': 'White'},
{'value': 144, 'label': 'Color change'},
{'value': 160, 'label': 'Color flow'},
{'value': 176, 'label': 'Color dream'},
{'value': 192, 'label': 'Multi flow'},
{'value': 208, 'label': 'Dream flow'},
{'value': 224, 'label': 'Two color flow'},
{'value': 240, 'label': 'Sound activity'}
]
},
'dimmer': {
'type': 'slider',
'min': 0,
'max': 255
}
}
}
}

7
dmx.js Normal file
View file

@ -0,0 +1,7 @@
var drv = require('./drivers/enttec-usb-dmx-pro.js');
universe = new drv.init(0);
universe.update({0: 1, 1:0xff, 6: 20, 7: 0xff}, 20)

View file

@ -0,0 +1,50 @@
var Ftdi = require('./node-ftdi/index');
var ENTTEC_PRO_DMX_STARTCODE = 0x00
, ENTTEC_PRO_START_OF_MSG = 0x7e
, ENTTEC_PRO_END_OF_MSG = 0xe7
, ENTTEC_PRO_SEND_DMX_RQ = 0x06
, ENTTEC_PRO_RECV_DMX_PKT = 0x05
;
exports.init = function(dev_id) {
var send_universe = function(dev, universe) {
var hdr = Buffer([
ENTTEC_PRO_START_OF_MSG,
ENTTEC_PRO_SEND_DMX_RQ,
(universe.length + 1) & 0xff,
((universe.length + 1) >> 8) & 0xff,
ENTTEC_PRO_DMX_STARTCODE
])
var msg = Buffer.concat([
hdr,
universe,
Buffer([ENTTEC_PRO_END_OF_MSG])
])
console.log(msg)
dev.write(msg)
}
var universe = new Buffer(512)
universe.fill(0)
var dev = new Ftdi({'index': dev_id});
dev.open();
dev.setBaudrate(250000);
dev.setLineProperty(Ftdi.BITS_8, Ftdi.STOP_BIT_2, Ftdi.NONE);
this.update = function(u) {
for(var k in u) {
universe[k] = u[k]
}
}
setInterval(function() {
send_universe(dev, universe);
}, 1000);
return this;
}

20
setup.js Normal file
View file

@ -0,0 +1,20 @@
exports.setup = {
universes: {
'office': {
'output': {
'driver': 'enttec-usb-dmx-pro',
'device': 0
},
'devices': [
{
'type': 'eurolite-led-bar',
'address': 1
},
{
'type': 'eurolite-led-bar',
'address': 13
}
]
}
}
}