refactor: Improve RSSI reading robustness in connection info (#3798)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-11-24 12:57:23 -06:00 committed by GitHub
parent 02dda17a87
commit 3e4e9d5f29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,8 +55,10 @@ import org.meshtastic.core.ui.theme.StatusColors.StatusRed
import org.meshtastic.proto.MeshProtos
import org.meshtastic.proto.PaxcountProtos
import org.meshtastic.proto.TelemetryProtos
import timber.log.Timber
import kotlin.time.Duration.Companion.seconds
@Suppress("TooGenericExceptionCaught")
@Composable
fun CurrentlyConnectedInfo(
node: Node,
@ -69,8 +71,12 @@ fun CurrentlyConnectedInfo(
LaunchedEffect(bleDevice) {
if (bleDevice != null) {
while (bleDevice.peripheral.isConnected) {
rssi = bleDevice.peripheral.readRssi()
delay(10.seconds)
try {
rssi = bleDevice.peripheral.readRssi()
delay(10.seconds)
} catch (e: Exception) {
Timber.e(e, "Failed to read RSSI")
}
}
}
}