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

Fixed timeout closing of 'Reset to custom defaults' dialog.

This commit is contained in:
mikeller 2020-05-04 00:10:23 +12:00
parent 1e0d7f0c23
commit 45fdccf0b0

View file

@ -157,7 +157,7 @@ function finishClose(finishedCallback) {
connectedTime = undefined; connectedTime = undefined;
} }
// close reset to custom defaults dialog // close reset to custom defaults dialog
$('#dialogResetToCustomDefaults-cancelbtn').click(); $('#dialogResetToCustomDefaults')[0].close();
analytics.resetFlightControllerData(); analytics.resetFlightControllerData();
@ -198,6 +198,16 @@ function finishClose(finishedCallback) {
finishedCallback(); finishedCallback();
} }
function setConnectionTimeout() {
// disconnect after 10 seconds with error if we don't get IDENT data
GUI.timeout_add('connecting', function () {
if (!CONFIGURATOR.connectionValid) {
GUI.log(i18n.getMessage('noConfigurationReceived'));
$('div.connect_controls a.connect').click(); // disconnect
}
}, 10000);
}
function onOpen(openInfo) { function onOpen(openInfo) {
if (openInfo) { if (openInfo) {
@ -224,14 +234,7 @@ function onOpen(openInfo) {
serial.onReceive.addListener(read_serial); serial.onReceive.addListener(read_serial);
// disconnect after 10 seconds with error if we don't get IDENT data setConnectionTimeout();
GUI.timeout_add('connecting', function () {
if (!CONFIGURATOR.connectionValid) {
GUI.log(i18n.getMessage('noConfigurationReceived'));
$('div.connect_controls a.connect').click(); // disconnect
}
}, 10000);
FC.resetState(); FC.resetState();
MSP.listen(update_packet_error); MSP.listen(update_packet_error);
@ -339,7 +342,7 @@ function processBoardInfo() {
dialog.close(); dialog.close();
GUI.timeout_add('connecting', function () { GUI.timeout_add('disconnect', function () {
$('div.connect_controls a.connect').click(); // disconnect $('div.connect_controls a.connect').click(); // disconnect
}, 0); }, 0);
}); });
@ -349,10 +352,14 @@ function processBoardInfo() {
dialog.close(); dialog.close();
setConnectionTimeout();
checkReportProblems(); checkReportProblems();
}); });
dialog.showModal(); dialog.showModal();
GUI.timeout_remove('connecting'); // kill connecting timer
} else { } else {
checkReportProblems(); checkReportProblems();
} }