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:
parent
ebd77db93f
commit
d319132135
1 changed files with 16 additions and 14 deletions
30
js/serial.js
30
js/serial.js
|
@ -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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue