From ab7ad4b07dea7ca90d3c78bbf151fc7b9cb3b5ed Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 12 Jan 2016 19:35:13 +0100 Subject: [PATCH] Handle 'overrun' conditions the same way as 'break' conditions. --- js/serial.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/js/serial.js b/js/serial.js index bbb92de5..03b0adf5 100644 --- a/js/serial.js +++ b/js/serial.js @@ -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 failure 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;