Only do SMB if invoke is from EventNewBG

This commit is contained in:
Roumen Georgiev 2017-09-15 09:33:07 +00:00
parent 1bd938c8d5
commit 6ef4b0c2a9

View file

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