mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
different approach to serial API logging
This commit is contained in:
parent
58877b0bd2
commit
aa49e8c375
3 changed files with 15 additions and 19 deletions
12
js/serial.js
12
js/serial.js
|
@ -6,6 +6,11 @@ var serial = {
|
|||
|
||||
chrome.serial.connect(path, options, function(connectionInfo) {
|
||||
self.connectionId = connectionInfo.connectionId;
|
||||
|
||||
if (connectionInfo.connectionId > 0) {
|
||||
console.log('SERIAL: Connection opened with ID: ' + connectionInfo.connectionId + ', Baud: ' + connectionInfo.bitrate);
|
||||
}
|
||||
|
||||
callback(connectionInfo);
|
||||
});
|
||||
},
|
||||
|
@ -13,7 +18,14 @@ var serial = {
|
|||
var self = this;
|
||||
|
||||
chrome.serial.disconnect(this.connectionId, function(result) {
|
||||
if (result) {
|
||||
console.log('SERIAL: Connection with ID: ' + self.connectionId + ' closed');
|
||||
} else {
|
||||
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
|
||||
}
|
||||
|
||||
self.connectionId = -1;
|
||||
|
||||
callback(result);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue