Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition #31

Open
cactrot opened this issue Sep 17, 2015 · 1 comment
Open

Race condition #31

cactrot opened this issue Sep 17, 2015 · 1 comment

Comments

@cactrot
Copy link

cactrot commented Sep 17, 2015

Chrome 45 windows 8.1 probably affects others using a HC-06 bluetoooth to serial adapter

With my setup line: 507 "set_receive_handler" callback would be processed before line: 506

"device.open" would finish, so the device was not set when it was called and it would return without

setting the receive handler.

So I tried moving the "set_receive_handler" call to the ready callback for "device.open".

I was able to connect and set the LED pins. Although the readback was a little spotty.

I think the polling function might need some fine turning for the high latency.

console.log('Attempting connection with ' + device.id);
    device.open({ stopBits: 0, bitRate: 57600, ctsFlowControl: 0 }, function() {
      device.set_receive_handler(function(data) {
        var inputData = new Uint8Array(data);
        processInput(inputData);
      });
    });
@davecraig
Copy link

Ah yes, I see this too. I started writing a bit of a Firmata port for Microbit and hit the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants