ConfigBuilder.applyAPSRequest: set new TBR if current TBR expires before next loop iteration.

This commit is contained in:
Johannes Mockenhaupt 2017-11-10 01:26:17 +01:00
parent 5d077c329a
commit 7163fbae54
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -579,7 +579,9 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: Basal set correctly"); log.debug("applyAPSRequest: Basal set correctly");
} }
} else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRateHistory()) < getPumpDescription().basalStep) { } else if (isTempBasalInProgress()
&& getTempBasalRemainingMinutesFromHistory() > 5
&& Math.abs(request.rate - getTempBasalAbsoluteRateHistory()) < getPumpDescription().basalStep) {
result = new PumpEnactResult(); result = new PumpEnactResult();
result.absolute = getTempBasalAbsoluteRateHistory(); result.absolute = getTempBasalAbsoluteRateHistory();
result.duration = getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes(); result.duration = getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes();