diff --git a/Testing-Combo.md b/Testing-Combo.md index 7346561c56..6550f5f9b8 100644 --- a/Testing-Combo.md +++ b/Testing-Combo.md @@ -35,6 +35,16 @@ It might be interesting to experiment with the Config software to set lower menu or display timeouts (or whatever they're called ...) to improve recovery speed. - [ ] Same as above while bolusing must report an error and NOT retry the command + - [ ] Recovery from connection issues during bolusing + - [ ] Bolusing still works => No error dialog, record is added to treatments + - [ ] Cancelling the bolus still works (while bolus is in progress) + - [ ] Pressing a button on the pump during delivery => Progress dialog freezes, then states that recovery + is in process and then closes; no error dialog, record correctly added to treatments + - [ ] Breaking the connection e.g. by moving the pump away from phone for up to a minute => same as above + - [ ] Same as above but put pump out of reach for 5 minutes => Error dialog, no record in treatments + - [ ] Starting a bolus bigger than what's left in the reservoir => Error dialog and a record in treatments with the partially delivered bolus + - [ ] When the connection breaks during bolusing, pressing the cancel button should not interfere with recovery and + the delivered bolus should be added to treatments - [ ] AAPS start - [ ] Starting AAPS without a reachable pump must show something sensible in the Combo tab (not hanging indefinitely with "initializing" activity) 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 c88d954dee..e184426504 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 @@ -405,7 +405,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf event.status = MainApp.sResources.getString(R.string.bolusstopped); break; case RECOVERING: - event.status = "Connection was interrupted. Please wait while recovery takes place."; + event.status = MainApp.sResources.getString(R.string.combo_error_bolus_recovery_progress); case FINISHED: // no state, just percent below to close bolus progress dialog break; @@ -504,19 +504,20 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf /** - * 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 the bolus was requested + * If there was an error during BolusCommand the scripter reconnects and cleans up. The pump + * refuses connections while a bolus delivery is still in progress (once bolus delivery started + * it continues regardless of a connection loss). + * Then verify the bolus record we read has a date which is >= the time the bolus was requested * (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. + * from this command and shall be added to treatments. If the bolus wasn't delivered in full, + * add it to treatments but raise a warning. Raise a warning as well if no bolus was delivered + * at all. + * This all still might fail for very large boluses and earthquakes in which case an error + * is raised asking to user to deal with it. */ private PumpEnactResult recoverFromErrorDuringBolusDelivery(DetailedBolusInfo detailedBolusInfo, long pumpTimeWhenBolusWasRequested) { log.debug("Trying to determine from pump history what was actually delivered"); - CommandResult readLastBolusResult = runCommand(null , 3, + CommandResult readLastBolusResult = runCommand(null , 2, () -> ruffyScripter.readHistory(new PumpHistoryRequest().bolusHistory(PumpHistoryRequest.LAST))); if (!readLastBolusResult.success || readLastBolusResult.history == null) { // this happens when the cartridge runs empty during delivery, the pump will be in an error @@ -527,7 +528,8 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf List bolusHistory = readLastBolusResult.history.bolusHistory; Bolus lastBolus = !bolusHistory.isEmpty() ? bolusHistory.get(0) : null; - log.debug("Last bolus read from history: " + lastBolus + ", request time: " + pumpTimeWhenBolusWasRequested); + log.debug("Last bolus read from history: " + lastBolus + ", request time: " + + pumpTimeWhenBolusWasRequested + " (" + new Date(pumpTimeWhenBolusWasRequested) + ")"); if (lastBolus == null // no bolus ever given || lastBolus.timestamp < pumpTimeWhenBolusWasRequested // this is not the bolus you're looking for diff --git a/app/src/main/res/layout/overview_bolusprogress_dialog.xml b/app/src/main/res/layout/overview_bolusprogress_dialog.xml index 2caa547c1e..85fe401052 100644 --- a/app/src/main/res/layout/overview_bolusprogress_dialog.xml +++ b/app/src/main/res/layout/overview_bolusprogress_dialog.xml @@ -11,6 +11,8 @@ android:id="@+id/overview_bolusprogress_status" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingLeft="10dp" + android:paddingRight="10dp" android:layout_gravity="center_horizontal" />