1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 11:59:51 +03:00

Handle 'overrun' conditions the same way as 'break' conditions.

This commit is contained in:
Dominic Clifton 2016-01-12 19:35:13 +01:00
parent 2f6be0650f
commit ab7ad4b07d

View file

@ -68,17 +68,20 @@ var serial = {
});
}
break;
case 'break':
// This occurs on F1 boards with old firmware during reboot
case 'overrun':
// wait 50 ms and attempt recovery
self.error = info.error;
setTimeout(function() {
chrome.serial.setPaused(info.connectionId, false, function() {
self.getInfo(function (info) {
if (info.paused) {
// 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...');
googleAnalytics.sendException('Serial: break condition - unrecoverable', false);
googleAnalytics.sendException('Serial: ' + self.error + ' - unrecoverable', false);
if (GUI.connected_to || GUI.connecting_to) {
$('a.connect').click();
@ -87,19 +90,22 @@ var serial = {
}
}
else {
console.log('SERIAL: Connection recovered from break condition');
googleAnalytics.sendException('Serial: break condition - recovered', false);
console.log('SERIAL: Connection recovered from ' + self.error + ' condition');
googleAnalytics.sendException('Serial: ' + self.error + ' - recovered', false);
}
});
});
}, 50);
break;
case 'timeout':
// TODO
break;
case 'device_lost':
// TODO
break;
case 'disconnected':
// TODO
break;