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

Fix autoconnect (#4407)

* Fix autoconnect

* Add constant
This commit is contained in:
Mark Haslinghuis 2025-03-31 21:15:03 +02:00 committed by GitHub
parent 75aa30a562
commit c842b9d60b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,6 +36,7 @@ let liveDataRefreshTimerId = false;
let isConnected = false;
const REBOOT_CONNECT_MAX_TIME_MS = 10000;
const REBOOT_GRACE_PERIOD_MS = 2000;
let rebootTimestamp = 0;
const toggleStatus = function () {
@ -109,6 +110,12 @@ function connectDisconnect() {
return;
}
// When rebooting, adhere to the auto-connect setting
if (!PortHandler.portPicker.autoConnect && Date.now() - rebootTimestamp < REBOOT_GRACE_PERIOD_MS) {
console.log(`${logHead} Rebooting, not connecting`);
return;
}
console.log(`${logHead} Connecting to: ${portName}`);
GUI.connecting_to = portName;