Fix false error popup when cancelling bolus after confirmation on the pump, during the wait before delivery starts.

This commit is contained in:
Johannes Mockenhaupt 2017-11-12 02:06:32 +01:00
parent 11777f8b7f
commit 9606df13b7
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -374,13 +374,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
.comment(MainApp.instance().getString(R.string.virtualpump_resultok)); .comment(MainApp.instance().getString(R.string.virtualpump_resultok));
} }
} finally { } finally {
cancelBolus = false;
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());
} }
} }
@NonNull @NonNull
private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) { private PumpEnactResult deliverBolus(final DetailedBolusInfo detailedBolusInfo) {
// guard against boluses issued multiple times within a minute
if (lastRequestedBolus != null if (lastRequestedBolus != null
&& Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.05 && Math.abs(lastRequestedBolus.amount - detailedBolusInfo.insulin) < 0.05
&& lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) { && lastRequestedBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
@ -459,12 +459,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
} }
} finally { } finally {
// BolusCommand.execute() intentionally doesn't close the progress dialog if an error // 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 // this method did recovery
bolusProgressReporter.report(FINISHED, 100, 0); bolusProgressReporter.report(FINISHED, 100, 0);
pump.activity = null; pump.activity = null;
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());
MainApp.bus().post(new EventRefreshOverview("Combo Bolus")); MainApp.bus().post(new EventRefreshOverview("Combo Bolus"));
cancelBolus = false;
} }
} }
@ -472,9 +473,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
public void stopBolusDelivering() { public void stopBolusDelivering() {
if (bolusInProgress) { if (bolusInProgress) {
ruffyScripter.cancelBolus(); ruffyScripter.cancelBolus();
} else {
cancelBolus = true;
} }
cancelBolus = true;
} }
// Note: AAPS calls this only to enact OpenAPS recommendations // Note: AAPS calls this only to enact OpenAPS recommendations