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 0ea643bad8..ceefccd76c 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 @@ -496,12 +496,14 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf /** - * If there was an error during BolusCommand the scripter will have reconnected as needed and waited - * for a bolus delivery to complete (once bolus delivery started it continues regardless of a connection loss). - * So, here we are with a connection again, let's read the last bolus record and check if - * its date is >= the time this command started (using the pump's time!). - * If there is such a bolus with <= the requested amount, then it's from this - * command and shall be added to treatments. If the bolus wasn't delivered in full + * If there was an error during BolusCommand the scripter try to reconnect. The pump refuses + * connections while a bolus delivery is still in progress (once bolus delivery started it + * continues regardless of a connection loss), retry the read history command a few + * times if we run into the 90s connect timeout (with 3 retries, a bolus of up to 54 U could + * be delivered until we give up). + * Then verify the bolus record we read has a date which is >= the time this command started + * (using the pump's time!). If there is such a bolus with <= the requested amount, then it's + * from this command and shall be added to treatments. If the bolus wasn't delivered in full * add it but raise a warning. Raise a warning as well if no bolus was delivered at all. */ private PumpEnactResult recoverFromErrorDuringBolusDelivery(DetailedBolusInfo detailedBolusInfo, long pumpTimeAtStartOfCommand) { diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index c50c639084..759c1b6f2c 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -363,21 +363,6 @@ public class RuffyScripter implements RuffyCommands { return false; } } - - // if everything broke before, the pump might still be delivering a bolus, if that's the case, wait for bolus to finish - Double bolusRemaining = (Double) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING); - BolusType bolusType = (BolusType) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_TYPE); - if (bolusType != null && bolusType == BolusType.NORMAL) { - try { - while (isConnected() && bolusRemaining != null) { - log.debug("Waiting for bolus from previous connection to complete, remaining: " + bolusRemaining); - waitForScreenUpdate(); - } - } catch (Exception e) { - log.error("Exception waiting for bolus from previous command to finish", e); - return false; - } - } return true; } @@ -404,17 +389,6 @@ public class RuffyScripter implements RuffyCommands { } } - // A BOLUS CANCELLED alert is raised BEFORE a bolus is started. If a disconnect occurs after a - // bolus has started (or the user interacts with the pump) the bolus continues. - // If that happened, wait till the pump has finished the bolus, then it can be read from - // the history as delivered. - Double bolusRemaining = (Double) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING); - BolusType bolusType = (BolusType) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_TYPE); - while (isConnected() && bolusRemaining != null && bolusType == BolusType.NORMAL) { - waitForScreenUpdate(); - bolusRemaining = (Double) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_REMAINING); - bolusType = (BolusType) getCurrentMenu().getAttribute(MenuAttribute.BOLUS_TYPE); - } boolean connected = isConnected(); if (connected) { MenuType menuType = getCurrentMenu().getType();