1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

add a default handler for serial errors (disconnect)

Also cleaned up some tabs and extra spaces in the file. The 'timeout' case has revised comment, to remove TODO.
This commit is contained in:
Kyle K 2019-07-04 17:57:49 +00:00
parent bc1c4f4fa5
commit 083f3e31b0

View file

@ -52,8 +52,6 @@ var serial = {
});
self.onReceiveError.addListener(function watch_for_on_receive_errors(info) {
console.error(info);
switch (info.error) {
case 'system_error': // we might be able to recover from this one
if (!self.failed++) {
@ -84,8 +82,6 @@ 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;
@ -114,11 +110,17 @@ var serial = {
break;
case 'timeout':
// TODO
// No data has been received for receiveTimeout milliseconds.
// We will do nothing.
break;
case 'break': // This seems to be the error that is thrown under NW.js in Windows when the device reboots after typing 'exit' in CLI
case 'disconnected':
case 'device_lost':
case 'frame_error':
case 'parity_error':
default:
console.log("serial disconnecting: " + info.error);
CONFIG.armingDisabled = false;
CONFIG.runawayTakeoffPreventionDisabled = false;
@ -128,10 +130,6 @@ var serial = {
self.disconnect();
}
break;
case 'disconnected':
// TODO
break;
}
});