1
0
Fork 0
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:
cTn 2014-01-25 13:48:31 +01:00
parent 58877b0bd2
commit aa49e8c375
3 changed files with 15 additions and 19 deletions

View file

@ -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);
});
},