From ac935b19deb8ceb91df16e84fe0c6f8801058b6e Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 25 Nov 2017 00:52:33 +0100 Subject: [PATCH] SetTempBasal: if requested percentage is rounded to 100%, do a soft cancel instead. --- README-Combo.md | 2 ++ .../nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/README-Combo.md b/README-Combo.md index 3a71d339b0..1506ad2503 100644 --- a/README-Combo.md +++ b/README-Combo.md @@ -40,6 +40,7 @@ Setup v2: - Set maximum TBR to 500% - Disable end of TBR alert - Set low cartridge alarm to your licking + - Enable keylock (can also be set on the pump directly, see usage section on reasoning) - Get ruffy from https://github.com/jotomo/ruffy (branch `combo-scripter-v2`) - Pair the pump, if it doesn't work, switch to the `pairing` branch, pair, then switch back the original branch. Note that AndroidAPS must not try to @@ -59,6 +60,7 @@ Usage: advanced loop functionality). - It's recommended to enable key lock on the pump to prevent bolusing from the pump, esp. when the pump was used before and quick bolusing was a habit. + Also, with keylock enabled, accidentally pressing a key will NOT interrupt a running command - When a BOLUS/TBR CANCELLED alert starts on the pump during bolusing or setting a TBR, this is caused by a disconnect between pump and phone. The app will try to reconnect and confirm the alert and then retry the last action (boluses are NOT retried for safety reasons). Therefore, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index eebac061fd..8623d68502 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -584,6 +584,11 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf adjustedPercent = rounded.intValue(); } + // do a soft TBR-cancel when requested rate was rounded to 100% (>94% && <104%) + if (adjustedPercent == 100) { + return cancelTempBasal(false); + } + int finalAdjustedPercent = adjustedPercent; CommandResult commandResult = runCommand(MainApp.sResources.getString(R.string.combo_pump_action_setting_tbr, percent, durationInMinutes), 3, () -> ruffyScripter.setTbr(finalAdjustedPercent, durationInMinutes));