diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java index d02441c5e2..9d45ff8132 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java @@ -573,7 +573,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, } if (percent > getPumpDescription().maxTempPercent) percent = getPumpDescription().maxTempPercent; - if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { + TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + if (runningTB != null && runningTB.percentRate == percent) { result.enacted = false; result.success = true; result.isTempCancel = false; @@ -639,7 +640,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, int durationInHalfHours = Math.max(durationInMinutes / 30, 1); insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1)); PumpEnactResult result = new PumpEnactResult(); - if (pump.isExtendedInProgress && Math.abs(pump.extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) { + ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()); + if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = false; result.success = true; result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); @@ -676,7 +678,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, @Override public PumpEnactResult cancelTempBasal(boolean force) { PumpEnactResult result = new PumpEnactResult(); - if (pump.isTempBasalInProgress) { + TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); + if (runningTB != null) { connectIfNotConnected("tempBasalStop"); danaRSService.tempBasalStop(); result.enacted = true; @@ -701,7 +704,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface, @Override public PumpEnactResult cancelExtendedBolus() { PumpEnactResult result = new PumpEnactResult(); - if (pump.isExtendedInProgress) { + ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis()); + if (runningEB != null) { connectIfNotConnected("extendedBolusStop"); danaRSService.extendedBolusStop(); result.enacted = true;