1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

serial error events hookup

This commit is contained in:
cTn 2014-06-30 02:37:29 +02:00
parent cf9ee40353
commit f269c8a8b4

View file

@ -23,6 +23,7 @@ var serial = {
self.onReceiveError.addListener(function watch_for_on_receive_errors(info) {
console.error(info);
ga_tracker.sendEvent('Error', 'Serial', info.error);
// valid conditions are 'disconnected', 'timeout', 'device_lost', 'system_error'
if (info.error == 'system_error') {
@ -38,6 +39,7 @@ var serial = {
callback(connectionInfo);
} else {
console.log('SERIAL: Failed to open serial port');
ga_tracker.sendEvent('Error', 'Serial', 'FailedToOpen');
callback(false);
}
});
@ -61,6 +63,7 @@ var serial = {
console.log('SERIAL: Connection with ID: ' + self.connectionId + ' closed');
} else {
console.log('SERIAL: Failed to close connection with ID: ' + self.connectionId + ' closed');
ga_tracker.sendEvent('Error', 'Serial', 'FailedToClose');
}
console.log('SERIAL: Statistics - Sent: ' + self.bytes_sent + ' bytes, Received: ' + self.bytes_received + ' bytes');