mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 20:10:11 +03:00
Handle 'overrun' conditions the same way as 'break' conditions.
This commit is contained in:
parent
2f6be0650f
commit
ab7ad4b07d
1 changed files with 10 additions and 4 deletions
14
js/serial.js
14
js/serial.js
|
@ -68,17 +68,20 @@ var serial = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'break':
|
case 'break':
|
||||||
// This occurs on F1 boards with old firmware during reboot
|
// This occurs on F1 boards with old firmware during reboot
|
||||||
|
case 'overrun':
|
||||||
// wait 50 ms and attempt recovery
|
// wait 50 ms and attempt recovery
|
||||||
|
self.error = info.error;
|
||||||
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.paused) {
|
||||||
// assume unrecoverable, disconnect
|
// assume unrecoverable, disconnect
|
||||||
console.log('SERIAL: Connection did not recover from break condition, disconnecting');
|
console.log('SERIAL: Connection did not recover from ' + self.error + ' condition, disconnecting');
|
||||||
GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...');
|
GUI.log('Unrecoverable <span style="color: red">failure</span> of serial connection, disconnecting...');
|
||||||
googleAnalytics.sendException('Serial: break condition - unrecoverable', false);
|
googleAnalytics.sendException('Serial: ' + self.error + ' - unrecoverable', false);
|
||||||
|
|
||||||
if (GUI.connected_to || GUI.connecting_to) {
|
if (GUI.connected_to || GUI.connecting_to) {
|
||||||
$('a.connect').click();
|
$('a.connect').click();
|
||||||
|
@ -87,19 +90,22 @@ var serial = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('SERIAL: Connection recovered from break condition');
|
console.log('SERIAL: Connection recovered from ' + self.error + ' condition');
|
||||||
googleAnalytics.sendException('Serial: break condition - recovered', false);
|
googleAnalytics.sendException('Serial: ' + self.error + ' - recovered', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'timeout':
|
case 'timeout':
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'device_lost':
|
case 'device_lost':
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue