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:
parent
0f96175655
commit
461e2db634
2 changed files with 16 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue