Ignore requests to issue BolusCommands for zero units.

This commit is contained in:
Johannes Mockenhaupt 2017-07-14 14:52:39 +02:00
parent 5f1ab4e45c
commit 1c1a28f0a8
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -240,6 +240,17 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
if (detailedBolusInfo.insulin < 0.05) {
log.debug("Ignoring request to deliver bolus of " + detailedBolusInfo.insulin + " U");
// Don't bother the pump when only carbs have been entered
// TODO find out if this should be prevented earlier on, or if there's a reason
// the pump (danar?) is still called (fetch data for next calc?)
PumpEnactResult pumpEnactResult = new PumpEnactResult();
pumpEnactResult.success = true;
pumpEnactResult.enacted = false;
pumpEnactResult.bolusDelivered = 0d;
return pumpEnactResult;
}
try {
Command command = new BolusCommand(detailedBolusInfo.insulin);
CommandResult commandResult = ruffyScripter.runCommand(command);