You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm pretty sure this directly relates to #82. But really I have no idea.
Tried this out in versions 0.7.1 and 0.9.2 on OS X 10.9.2
Basically I'm writing an application that writes to some lab equipment over a serial port connection using node-serialport.
The application writes to the lab equipment, the lab equipment acks, then the application sends its next ack. The lab equipment can buffer a series of commands so it will ack a whole bunch in a row until its buffer is full, and then ack as it needs to to fill its buffer.
Basically the troubled code looks like this
serialport = require("serialport");
var default_settings = {baudrate: 115200, parser: serialport.parsers.readline("\n")};
var message_queue = ["message1", "message2"....]; //long list of messages
port = new serialport.SerialPort("/dev/tty###", default_settings, false);
port.open();
port.on('data', function(data){
write_next_message(data);
})
function write_next_message(data){
var message = message_queue.pop();
port.write(message + '\r', function(err, results){
//I'm actually doing something in here with err/results
});
}
Basically when I run this it will buffer 3 or 4 commands very quickly (3-5ms) and then hang for 500ms and then repeat. This causes the lab equipment to stutter (not good).
I have a script which does the same thing (sans a ui) written in python which works fine. So I know its not the equipment
First, I had this wrapped up in an angularjs service so I figured it might have something to do with the angular digest loop. So I ripped it out and then ran it as script in the window context. Same thing. I played around with this for awhile because I thought it had something to do with the node context and the window context mixing and things failing silently. This had a really strange result. Out of 10 runs of the same code the program would stutter 9 times and work once. No idea why or how that made sense. Took out all my logging, put it back in, put timing code in, tried virtual serial ports that immediately acked back. Couldn't figure out what was going on. I couldn't consistently get it to work. I tried sticking a bunch of port.drains() in and waiting until the port 'drained' until I wrote the next line. No dice.
Then I tried moving it all into a node module and requiring that in the main html document. Same deal.
Next I tried running the script outside of node-webkit just as a node script. Success.
Then I tried moving it to the node-main script. Which actually never ran because I had to compile it (node-pre-gyp rebuild --target=0.10.12 --runtime=node --target-arch=ia32) to run in the node context which then merged with the window context which broke it. Was getting some kind of dyld: lazy symbol binding failed: Symbol not found error.
Finally, I found #82 and figured I might try it out on my linux box where the original code worked no problems.
I'm pretty sure this directly relates to #82. But really I have no idea.
Tried this out in versions 0.7.1 and 0.9.2 on OS X 10.9.2
Basically I'm writing an application that writes to some lab equipment over a serial port connection using node-serialport.
The application writes to the lab equipment, the lab equipment acks, then the application sends its next ack. The lab equipment can buffer a series of commands so it will ack a whole bunch in a row until its buffer is full, and then ack as it needs to to fill its buffer.
Basically the troubled code looks like this
Basically when I run this it will buffer 3 or 4 commands very quickly (3-5ms) and then hang for 500ms and then repeat. This causes the lab equipment to stutter (not good).
I have a script which does the same thing (sans a ui) written in python which works fine. So I know its not the equipment
First, I had this wrapped up in an angularjs service so I figured it might have something to do with the angular digest loop. So I ripped it out and then ran it as script in the window context. Same thing. I played around with this for awhile because I thought it had something to do with the node context and the window context mixing and things failing silently. This had a really strange result. Out of 10 runs of the same code the program would stutter 9 times and work once. No idea why or how that made sense. Took out all my logging, put it back in, put timing code in, tried virtual serial ports that immediately acked back. Couldn't figure out what was going on. I couldn't consistently get it to work. I tried sticking a bunch of port.drains() in and waiting until the port 'drained' until I wrote the next line. No dice.
Then I tried moving it all into a node module and requiring that in the main html document. Same deal.
Next I tried running the script outside of node-webkit just as a node script. Success.
Then I tried moving it to the node-main script. Which actually never ran because I had to compile it (
node-pre-gyp rebuild --target=0.10.12 --runtime=node --target-arch=ia32
) to run in the node context which then merged with the window context which broke it. Was getting some kind ofdyld: lazy symbol binding failed: Symbol not found
error.Finally, I found #82 and figured I might try it out on my linux box where the original code worked no problems.
Thoughts?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: