Open evantahler opened 10 years ago
I'm coming to this issue because I am experiencing strange behavior with my device. The code below I would expect to light up the first 4 DMX channels, but I'm actually seeing every-other channel lit up. It may be a parity issue, but from what I can tell, a parity of 'none'
is really what I want.
var ftdi = require('ftdi');
var settings = {
'baudrate': 115200 / 2,
'databits': 8,
'stopbits': 2,
'parity' : 'none',
};
var sleepTime = 20;
var device;
var universe = new Buffer([
0,
250,
250,
250,
250,
], 'hex');
function writeLoop(){
device.write(universe);
setTimeout(function(){
writeLoop();
}, sleepTime);
}
ftdi.find(function(err, devices){
console.log(devices);
device = new ftdi.FtdiDevice(devices[0]);
device.on('data', function(d){ console.log(d); });
device.on('error', function(e){ console.log(e); });
device.on('open', function(){ console.log('opened'); });
device.open(settings, function(){
writeLoop();
});
});
Sorry, node-ftdi does not support the old Win32 api. I would recommend to try it in c++ with the new api first and then to come back to js (node-ftdi). What do you think, is this a valid approach for you?
I don't think the new API works sadly. It's old cheap hardware :D Even the C# example uses the break on/off command.
Thanks for looking at it!
Probably
I'm coming to this issue because I am experiencing strange behavior with my device. The code below I would expect to light up the first 4 DMX channels, but I'm actually seeing every-other channel lit up. It may be a parity issue, but from what I can tell, a parity of
'none'
is really what I want.var ftdi = require('ftdi'); var settings = { 'baudrate': 115200 / 2, 'databits': 8, 'stopbits': 2, 'parity' : 'none', }; var sleepTime = 20; var device; var universe = new Buffer([ 0, 250, 250, 250, 250, ], 'hex'); function writeLoop(){ device.write(universe); setTimeout(function(){ writeLoop(); }, sleepTime); } ftdi.find(function(err, devices){ console.log(devices); device = new ftdi.FtdiDevice(devices[0]); device.on('data', function(d){ console.log(d); }); device.on('error', function(e){ console.log(e); }); device.on('open', function(){ console.log('opened'); }); device.open(settings, function(){ writeLoop(); }); });
Probably way too late, but first issue I can spot is DMX baud rate is 250000.
Regarding FT_W32_SetCommBreak, for all I know it's a wrapper around Win32 SetCommBreak function. So in Win32, you could use either. The FTDI API also exposes FT_SetBreakOn and FT_SetBreakOff that might do the job fine and be cross platform. Under Linux, using libftdi, you can use ftdi_set_line_property2 with BREAK_OFF or BREAK_ON. You could also use ioctl with TIOCSBRK/TIOCCBRK.
I have this old C++ Code which I am trying bring over to JS:
This code is to talk to a DMX lighting controller, which simply does:
0
)What would the equivalent methods to
FT_W32_SetCommBreak
andFT_W32_ClearCommBreak
be in this library? Are they handled for you by thewrite
method?The whole example C++ lib can be found here http://www.enttec.com/index.php?main_menu=Products&pn=70303