SetTempBasal: if requested percentage is rounded to 100%, do a soft cancel instead.

This commit is contained in:
Johannes Mockenhaupt 2017-11-25 00:52:33 +01:00
parent 63afb7bd84
commit ac935b19de
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 7 additions and 0 deletions

View file

@ -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,

View file

@ -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));