mirror of
https://github.com/scratchfoundation/scratchx.git
synced 2024-11-25 00:58:05 -05:00
Update PicoBoard + WeDo extensions from main site
This includes sync compatibility changes
This commit is contained in:
parent
374a4c5baf
commit
6c8387da72
2 changed files with 16 additions and 5 deletions
|
@ -127,15 +127,24 @@
|
|||
}
|
||||
}
|
||||
|
||||
var poller = null;
|
||||
var watchdog = null;
|
||||
function tryNextDevice() {
|
||||
// If potentialDevices is empty, device will be undefined.
|
||||
// That will get us back here next time a device is connected.
|
||||
device = potentialDevices.shift();
|
||||
if (!device) return;
|
||||
|
||||
device.open({ stopBits: 0, bitRate: 38400, ctsFlowControl: 0 });
|
||||
if (device) {
|
||||
device.open({ stopBits: 0, bitRate: 38400, ctsFlowControl: 0 }, deviceOpened);
|
||||
}
|
||||
}
|
||||
|
||||
var poller = null;
|
||||
var watchdog = null;
|
||||
function deviceOpened(dev) {
|
||||
if (!dev) {
|
||||
// Opening the port failed.
|
||||
tryNextDevice();
|
||||
return;
|
||||
}
|
||||
device.set_receive_handler(function(data) {
|
||||
//console.log('Received: ' + data.byteLength);
|
||||
if(!rawData || rawData.byteLength == 18) rawData = new Uint8Array(data);
|
||||
|
|
|
@ -285,7 +285,9 @@
|
|||
device = dev;
|
||||
device.open();
|
||||
poller = setInterval(function() {
|
||||
rawData = device.read();
|
||||
device.read(function(data) {
|
||||
rawData = data;
|
||||
});
|
||||
}, 20);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue