combov2: Show dedicated message when hitting unexpected TBR % limit

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2022-11-10 23:41:45 +01:00
parent ced93e4a53
commit 03d226e725
2 changed files with 9 additions and 0 deletions

View file

@ -56,6 +56,7 @@ import info.nightscout.comboctl.main.Pump as ComboCtlPump
import info.nightscout.comboctl.main.PumpManager as ComboCtlPumpManager import info.nightscout.comboctl.main.PumpManager as ComboCtlPumpManager
import info.nightscout.comboctl.base.Tbr as ComboCtlTbr import info.nightscout.comboctl.base.Tbr as ComboCtlTbr
import info.nightscout.comboctl.main.BasalProfile import info.nightscout.comboctl.main.BasalProfile
import info.nightscout.comboctl.main.QuantityNotChangingException
import info.nightscout.comboctl.main.RTCommandProgressStage import info.nightscout.comboctl.main.RTCommandProgressStage
import info.nightscout.comboctl.parser.AlertScreenContent import info.nightscout.comboctl.parser.AlertScreenContent
import info.nightscout.comboctl.parser.AlertScreenException import info.nightscout.comboctl.parser.AlertScreenException
@ -989,6 +990,13 @@ class ComboV2Plugin @Inject constructor (
enacted = true enacted = true
comment = rh.gs(R.string.combov2_setting_tbr_succeeded) comment = rh.gs(R.string.combov2_setting_tbr_succeeded)
} }
} catch (e: QuantityNotChangingException) {
aapsLogger.error(LTag.PUMP, "TBR percentage adjustment hit a limit: $e")
pumpEnactResult.apply {
success = false
enacted = false
comment = rh.gs(R.string.combov2_hit_unexpected_tbr_limit, e.targetQuantity, e.hitLimitAt)
}
} catch (e: ComboCtlPump.UnexpectedTbrStateException) { } catch (e: ComboCtlPump.UnexpectedTbrStateException) {
aapsLogger.error(LTag.PUMP, "Setting TBR failed with exception: $e") aapsLogger.error(LTag.PUMP, "Setting TBR failed with exception: $e")
pumpEnactResult.apply { pumpEnactResult.apply {

View file

@ -108,6 +108,7 @@ buttons at the same time to cancel pairing)\n
<string name="combov2_reservoir_low_warning">Pump reservoir level is low</string> <string name="combov2_reservoir_low_warning">Pump reservoir level is low</string>
<string name="combov2_setting_tbr_succeeded">Setting TBR succeeded</string> <string name="combov2_setting_tbr_succeeded">Setting TBR succeeded</string>
<string name="combov2_setting_tbr_failed">Setting TBR failed</string> <string name="combov2_setting_tbr_failed">Setting TBR failed</string>
<string name="combov2_hit_unexpected_tbr_limit">Unexpected limit encountered while adjusting TBR: target percentage was %1$d%%, hit a limit at %1$d%%</string>
<string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Cannot set absolute TBR if base basal rate is zero</string> <string name="combov2_cannot_set_absolute_tbr_if_basal_zero">Cannot set absolute TBR if base basal rate is zero</string>
<string name="combov2_pair_with_pump_summary">Pair AndroidAPS and Android with a currently unpaired Accu-Chek Combo pump</string> <string name="combov2_pair_with_pump_summary">Pair AndroidAPS and Android with a currently unpaired Accu-Chek Combo pump</string>
<string name="combov2_unpair_pump_summary">Unpair AndroidAPS and Android from the currently paired Accu-Chek Combo pump</string> <string name="combov2_unpair_pump_summary">Unpair AndroidAPS and Android from the currently paired Accu-Chek Combo pump</string>