1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-20 23:05:15 +03:00

Avoid exceptions when serial break or overruns occur without info

object.
This commit is contained in:
Dominic Clifton 2016-02-22 18:45:49 +01:00
parent ebd77db93f
commit d319132135

View file

@ -77,21 +77,23 @@ var serial = {
setTimeout(function() { setTimeout(function() {
chrome.serial.setPaused(info.connectionId, false, function() { chrome.serial.setPaused(info.connectionId, false, function() {
self.getInfo(function (info) { self.getInfo(function (info) {
if (info.paused) { if (info) {
// assume unrecoverable, disconnect if (info.paused) {
console.log('SERIAL: Connection did not recover from ' + self.error + ' condition, disconnecting'); // assume unrecoverable, disconnect
GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...'); console.log('SERIAL: Connection did not recover from ' + self.error + ' condition, disconnecting');
googleAnalytics.sendException('Serial: ' + self.error + ' - unrecoverable', false); GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...');
googleAnalytics.sendException('Serial: ' + self.error + ' - unrecoverable', false);
if (GUI.connected_to || GUI.connecting_to) {
$('a.connect').click(); if (GUI.connected_to || GUI.connecting_to) {
} else { $('a.connect').click();
self.disconnect(); } else {
self.disconnect();
}
}
else {
console.log('SERIAL: Connection recovered from ' + self.error + ' condition');
googleAnalytics.sendException('Serial: ' + self.error + ' - recovered', false);
} }
}
else {
console.log('SERIAL: Connection recovered from ' + self.error + ' condition');
googleAnalytics.sendException('Serial: ' + self.error + ' - recovered', false);
} }
}); });
}); });