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 b2e19253db..6a71eef58a 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 @@ -1091,17 +1091,34 @@ class ComboV2Plugin @Inject constructor ( return pumpEnactResult } - private fun setTbrInternal(percentage: Int, durationInMinutes: Int, tbrType: ComboCtlTbr.Type, force100Percent: Boolean, pumpEnactResult: PumpEnactResult) { + private fun setTbrInternal( + percentage: Int, + durationInMinutes: Int, + tbrType: ComboCtlTbr.Type, + force100Percent: Boolean, + pumpEnactResult: PumpEnactResult + ) { runBlocking { try { executeCommand { - pump!!.setTbr(percentage, durationInMinutes, tbrType, force100Percent) - } + val setTbrOutcome = pump!!.setTbr(percentage, durationInMinutes, tbrType, force100Percent) - pumpEnactResult.apply { - success = true - enacted = true - comment = rh.gs(R.string.combov2_setting_tbr_succeeded) + val tbrComment = when (setTbrOutcome) { + ComboCtlPump.SetTbrOutcome.SET_NORMAL_TBR -> + rh.gs(R.string.combov2_setting_tbr_succeeded) + ComboCtlPump.SetTbrOutcome.SET_EMULATED_100_TBR -> + rh.gs(R.string.combov2_set_emulated_100_tbr) + ComboCtlPump.SetTbrOutcome.LETTING_EMULATED_100_TBR_FINISH -> + rh.gs(R.string.combov2_letting_emulated_100_tbr_finish) + ComboCtlPump.SetTbrOutcome.IGNORED_REDUNDANT_100_TBR -> + rh.gs(R.string.combov2_ignoring_redundant_100_tbr) + } + + pumpEnactResult.apply { + success = true + enacted = true + comment = tbrComment + } } } catch (e: QuantityNotChangingException) { aapsLogger.error(LTag.PUMP, "TBR percentage adjustment hit a limit: $e") diff --git a/pump/combov2/src/main/res/values/strings.xml b/pump/combov2/src/main/res/values/strings.xml index 0e0516736b..ca0047ff78 100644 --- a/pump/combov2/src/main/res/values/strings.xml +++ b/pump/combov2/src/main/res/values/strings.xml @@ -107,6 +107,9 @@ buttons at the same time to cancel pairing)\n Pump reservoir level is low Setting TBR succeeded Setting TBR failed + Set emulated 100% TBR + Letting ongoing emulated 100% TBR finish + Ignoring redundant 100% TBR request Unexpected limit encountered while adjusting TBR: target percentage was %1$d%%, hit a limit at %1$d%% Cannot set absolute TBR if base basal rate is zero Pair AndroidAPS and Android with a currently unpaired Accu-Chek Combo pump