From 4146c8a770466ec5183fc948ad46fff958c420f7 Mon Sep 17 00:00:00 2001 From: TebbeUbben Date: Sat, 9 Feb 2019 23:14:57 +0100 Subject: [PATCH] Don't send final bolus event after bolus cancel --- .../plugins/PumpInsightLocal/LocalInsightPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java index cf35e954b3..4d9d66663c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsightLocal/LocalInsightPlugin.java @@ -538,6 +538,9 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con detailedBolusInfo.pumpId = insightBolusID.id; TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true); while (true) { + synchronized ($bolusLock) { + if (bolusID == -1) break; + } OperatingMode operatingMode = connectionService.requestMessage(new GetOperatingModeMessage()).await().getOperatingMode(); if (operatingMode != OperatingMode.STARTED) break; List activeBoluses = connectionService.requestMessage(new GetActiveBolusesMessage()).await().getActiveBoluses(); @@ -592,6 +595,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con CancelBolusMessage cancelBolusMessage = new CancelBolusMessage(); cancelBolusMessage.setBolusID(bolusID); connectionService.requestMessage(cancelBolusMessage).await(); + bolusID = -1; confirmAlert(AlertType.WARNING_38); } catch (AppLayerErrorException e) { log.info("Exception while canceling bolus: " + e.getClass().getCanonicalName() + " (" + e.getErrorCode() + ")");