limit requests on openloop mode

This commit is contained in:
Milos Kozak 2016-09-05 15:27:53 +02:00
parent 34d2178878
commit 47bff5ad5e

View file

@ -177,6 +177,13 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();
// Fix bug determine basal
if (determineBasalResult.rate == 0d && determineBasalResult.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) determineBasalResult.changeRequested = false;
// limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1)
determineBasalResult.changeRequested = false;
if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1)
determineBasalResult.changeRequested = false;
}
determineBasalResult.iob = iobTotal;