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 1335887957
commit a8a7d47da2
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -584,7 +584,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();