diff --git a/blessed/src/main/java/com/welie/blessed/BluetoothCentralManager.kt b/blessed/src/main/java/com/welie/blessed/BluetoothCentralManager.kt index 2c3f124..0784b96 100644 --- a/blessed/src/main/java/com/welie/blessed/BluetoothCentralManager.kt +++ b/blessed/src/main/java/com/welie/blessed/BluetoothCentralManager.kt @@ -860,8 +860,12 @@ class BluetoothCentralManager(private val context: Context) { private fun startDisconnectionTimer() { cancelDisconnectionTimer() disconnectRunnable = Runnable { - Logger.e(TAG, "bluetooth turned off but no automatic disconnects happening, so doing it ourselves") - cancelAllConnectionsWhenBluetoothOff() + if (expectingBluetoothOffDisconnects) { + Logger.e(TAG, "bluetooth turned off but no automatic disconnects happening, so doing it ourselves") + cancelAllConnectionsWhenBluetoothOff() + } else { + Logger.e(TAG, "bluetooth turning on since manual disconnection timer has been launched, don't disconnect") + } disconnectRunnable = null } mainHandler.postDelayed(disconnectRunnable!!, 1000)