diff --git a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt index 0c7b50402b..321b3273b0 100644 --- a/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt +++ b/pump/combov2/src/main/kotlin/info/nightscout/pump/combov2/ComboV2Plugin.kt @@ -292,7 +292,7 @@ class ComboV2Plugin @Inject constructor ( // Continue initialization in a separate coroutine. This allows us to call // runWithPermissionCheck(), which will keep trying to run the code block - // until either the necessary Bluetooth permissios are granted, or the + // until either the necessary Bluetooth permissions are granted, or the // coroutine is cancelled (see onStop() below). pumpCoroutineScope.launch { runWithPermissionCheck( @@ -378,7 +378,7 @@ class ComboV2Plugin @Inject constructor ( // Setup coroutine to enable/disable the pair and unpair // preferences depending on the pairing state. preferenceFragment.run { - // We use the fragment's lifecyle instead of the fragment view's, since the latter + // We use the fragment's lifecycle instead of the fragment view's, since the latter // is initialized in onCreateView(), and we reach this point here _before_ that // method is called. In other words, the fragment view does not exist at this point. // repeatOnLifecycle() is a utility function that runs its block when the lifecycle @@ -984,7 +984,7 @@ class ComboV2Plugin @Inject constructor ( // Store a local reference to the Pump instance. "pump" // is set to null in case of an error, because then, // disconnectInternal() is called (which sets pump to null). - // However, we still need to access the last deliverd bolus + // However, we still need to access the last delivered bolus // from the pump's lastBolusFlow, even if an error happened. // Solve this by storing this reference and accessing the // lastBolusFlow through it. @@ -1171,9 +1171,8 @@ class ComboV2Plugin @Inject constructor ( runBlocking { try { executeCommand { - val setTbrOutcome = pump!!.setTbr(percentage, durationInMinutes, tbrType, force100Percent) - val tbrComment = when (setTbrOutcome) { + val tbrComment = when (pump!!.setTbr(percentage, durationInMinutes, tbrType, force100Percent)) { ComboCtlPump.SetTbrOutcome.SET_NORMAL_TBR -> rh.gs(R.string.combov2_setting_tbr_succeeded) ComboCtlPump.SetTbrOutcome.SET_EMULATED_100_TBR -> @@ -2281,7 +2280,7 @@ class ComboV2Plugin @Inject constructor ( .comment(comment) private fun getBluetoothAddress(): ComboCtlBluetoothAddress? = - pumpManager!!.getPairedPumpAddresses().firstOrNull() + pumpManager?.getPairedPumpAddresses()?.firstOrNull() private fun isDisconnected() = when (driverStateFlow.value) {