From 9606df13b7670de3e07f7363f0c3e766c0f4852c Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 12 Nov 2017 02:06:32 +0100 Subject: [PATCH] Fix false error popup when cancelling bolus after confirmation on the pump, during the wait before delivery starts. --- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 16a94cc388..f63a687644 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -374,13 +374,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf .comment(MainApp.instance().getString(R.string.virtualpump_resultok)); } } finally { - cancelBolus = false; MainApp.bus().post(new EventComboPumpUpdateGUI()); } } @NonNull private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) { + // guard against boluses issued multiple times within a minute if (lastRequestedBolus != null && Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.05 && lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) { @@ -459,12 +459,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf } } finally { // BolusCommand.execute() intentionally doesn't close the progress dialog if an error - // occurred/ so it stays open while the connection was re-established if needed and/or + // occurred so it stays open while the connection was re-established if needed and/or // this method did recovery bolusProgressReporter.report(FINISHED, 100, 0); pump.activity = null; MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventRefreshOverview("Combo Bolus")); + cancelBolus = false; } } @@ -472,9 +473,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf public void stopBolusDelivering() { if (bolusInProgress) { ruffyScripter.cancelBolus(); - } else { - cancelBolus = true; } + cancelBolus = true; } // Note: AAPS calls this only to enact OpenAPS recommendations