diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java index ba01db465c..0040dbc6fc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopPlugin.java @@ -392,7 +392,7 @@ public class LoopPlugin extends PluginBase implements LoopInterface { } // Prepare for pumps using % basals - if (pump.getPumpDescription().tempBasalStyle == PumpDescription.PERCENT) { + if (pump.getPumpDescription().tempBasalStyle == PumpDescription.PERCENT && allowPercentage()) { result.usePercent = true; } result.percent = (int) (result.rate / profile.getBasal() * 100); @@ -650,7 +650,6 @@ public class LoopPlugin extends PluginBase implements LoopInterface { */ private void applyTBRRequest(APSResult request, Profile profile, Callback callback) { - boolean allowPercentage = virtualPumpPlugin.isEnabled(PluginType.PUMP); if (!request.tempBasalRequested) { if (callback != null) { @@ -681,7 +680,7 @@ public class LoopPlugin extends PluginBase implements LoopInterface { long now = System.currentTimeMillis(); TemporaryBasal activeTemp = treatmentsPlugin.getTempBasalFromHistory(now); - if (request.usePercent && allowPercentage) { + if (request.usePercent && allowPercentage()) { if (request.percent == 100 && request.duration == 0) { if (activeTemp != null) { getAapsLogger().debug(LTag.APS, "applyAPSRequest: cancelTempBasal()"); @@ -784,6 +783,10 @@ public class LoopPlugin extends PluginBase implements LoopInterface { commandQueue.bolus(detailedBolusInfo, callback); } + private boolean allowPercentage() { + return virtualPumpPlugin.isEnabled(PluginType.PUMP); + } + public void disconnectPump(int durationInMinutes, Profile profile) { PumpInterface pump = activePlugin.getActivePump();