fix: Implement reconnection logic and stabilize BLE connection flow (#4870)

This commit is contained in:
James Rich 2026-03-21 07:49:03 -05:00 committed by GitHub
parent 6e50db0b91
commit 3bd8669cbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 49 additions and 30 deletions

View file

@ -145,8 +145,6 @@ class BleRadioInterface(
private fun connect() {
connectionScope.launch {
val device = findDevice()
bleConnection.connectionState
.onEach { state ->
if (state is BleConnectionState.Disconnected && isFullyConnected) {
@ -171,6 +169,8 @@ class BleRadioInterface(
connectionStartTime = nowMillis
Logger.i { "[$address] BLE connection attempt started" }
val device = findDevice()
var state = bleConnection.connectAndAwait(device, CONNECTION_TIMEOUT_MS)
if (state !is BleConnectionState.Connected) {