mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
upgrading serial lib
This commit is contained in:
parent
0488359783
commit
4b2d5c4a48
1 changed files with 14 additions and 11 deletions
|
@ -10,6 +10,7 @@ var serial = {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
chrome.serial.connect(path, options, function(connectionInfo) {
|
chrome.serial.connect(path, options, function(connectionInfo) {
|
||||||
|
if (connectionInfo !== undefined) {
|
||||||
self.connectionId = connectionInfo.connectionId;
|
self.connectionId = connectionInfo.connectionId;
|
||||||
self.bytes_received = 0;
|
self.bytes_received = 0;
|
||||||
self.bytes_sent = 0;
|
self.bytes_sent = 0;
|
||||||
|
@ -18,11 +19,13 @@ var serial = {
|
||||||
self.bytes_received += info.data.byteLength;
|
self.bytes_received += info.data.byteLength;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (connectionInfo.connectionId > 0) {
|
|
||||||
console.log('SERIAL: Connection opened with ID: ' + connectionInfo.connectionId + ', Baud: ' + connectionInfo.bitrate);
|
console.log('SERIAL: Connection opened with ID: ' + connectionInfo.connectionId + ', Baud: ' + connectionInfo.bitrate);
|
||||||
}
|
|
||||||
|
|
||||||
callback(connectionInfo);
|
callback(connectionInfo);
|
||||||
|
} else {
|
||||||
|
console.log('SERIAL: Failed to open serial port');
|
||||||
|
callback(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
disconnect: function(callback) {
|
disconnect: function(callback) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue