diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index 54a9cd0795..83a8e9d5b2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -260,7 +260,12 @@ public class LoopPlugin implements PluginBase { // check rate for constrais final APSResult resultAfterConstraints = result.clone(); resultAfterConstraints.rate = constraintsInterface.applyBasalConstraints(resultAfterConstraints.rate); - resultAfterConstraints.smb = constraintsInterface.applyBolusConstraints(resultAfterConstraints.smb); + if(initiator == "EventNewBG") { + resultAfterConstraints.smb = constraintsInterface.applyBolusConstraints(resultAfterConstraints.smb); + } else { + log.debug("Loop is not invoked by EventNewBG so SMB is 0("+constraintsInterface.applyBolusConstraints(resultAfterConstraints.smb)+")"); + resultAfterConstraints.smb = 0.0; + } if (lastRun == null) lastRun = new LastRun(); lastRun.request = result;