1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Fix virtual reboot and auto-connect (#3933)

* Fix virtual reboot

* Fix sonar
This commit is contained in:
Mark Haslinghuis 2024-05-05 15:16:28 +02:00 committed by GitHub
parent 0f96175655
commit 461e2db634
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View file

@ -817,6 +817,9 @@ function startLiveDataRefreshTimer() {
}
export function reinitializeConnection(callback) {
const isVirtual = CONFIGURATOR.virtualMode && GUI.connected_to == 'virtual' && CONFIGURATOR.connectionValid && serial.connectionId === 'virtual';
gui_log(i18n.getMessage('deviceRebooting'));
// Close connection gracefully if it still exists.
const previousTimeStamp = connectionTimestamp;
@ -829,8 +832,19 @@ export function reinitializeConnection(callback) {
}
}
gui_log(i18n.getMessage('deviceRebooting'));
// In virtual mode reconnect when autoconnect is enabled
if (isVirtual) {
return setTimeout(() => {
if (GUI.auto_connect) {
$('a.connect').trigger('click');
}
if (typeof callback === 'function') {
callback();
}
}, 500);
}
// Wait for serial or tcp connection to be available
let attempts = 0;
const reconnect = setInterval(waitforSerial, 100);