From 12a71b8d3e20cf7f008d695c86d525bf9a992685 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 10:10:48 -0500 Subject: [PATCH 1/6] Prevent TBR from being cancelled twice when setting a new TBR --- .../plugins/pump/omnipod/comm/OmnipodManager.java | 13 ------------- .../omnipod/driver/comm/AapsOmnipodManager.java | 4 ---- app/src/main/res/values/strings.xml | 1 - 3 files changed, 18 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java index 684e8f234f..a8973a2791 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java @@ -200,28 +200,15 @@ public class OmnipodManager { } } - // CAUTION: cancels temp basal and then sets new temp basal. An OmnipodException[certainFailure=false] indicates that the pod might have cancelled the previous temp basal, but did not set a new temp basal public synchronized void setTemporaryBasal(TempBasalPair tempBasalPair, boolean acknowledgementBeep, boolean completionBeep) { assertReadyForDelivery(); logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]"); - try { - cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep); - } catch (Exception ex) { - logCommandExecutionFinished("setTemporaryBasal"); - throw ex; - } - try { executeAndVerify(() -> communicationService.executeAction(new SetTempBasalAction( podState, tempBasalPair.getInsulinRate(), Duration.standardMinutes(tempBasalPair.getDurationMinutes()), acknowledgementBeep, completionBeep))); - } catch (OmnipodException ex) { - // Treat all exceptions as uncertain failures, because all delivery has been suspended here. - // Setting this to an uncertain failure will enable for the user to get an appropriate warning - ex.setCertainFailure(false); - throw ex; } finally { logCommandExecutionFinished("setTemporaryBasal"); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java index dc9d16cf6c..ba5b2bd842 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java @@ -335,10 +335,6 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled); addSuccessToHistory(time, PodHistoryEntryType.SetTemporaryBasal, tempBasalPair); } catch (Exception ex) { - if ((ex instanceof OmnipodException) && !((OmnipodException) ex).isCertainFailure()) { - addToHistory(time, PodHistoryEntryType.SetTemporaryBasal, "Uncertain failure", false); - return new PumpEnactResult().success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_set_temp_basal_failed_uncertain)); - } String comment = handleAndTranslateException(ex); addFailureToHistory(time, PodHistoryEntryType.SetTemporaryBasal, comment); return new PumpEnactResult().success(false).enacted(false).comment(comment); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 92fc9785dc..4cf6716ace 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1761,7 +1761,6 @@ Low reservoir Unknown alert Setting basal profile might have failed. Delivery might be suspended! Please refresh pod status. - Setting temp basal might have failed. If there was a temp basal already running, that may have been cancelled! Please refresh pod status. Setting time might have failed. Delivery might be suspended! Please refresh pod status. Unable to verify whether the bolus succeeded. Please verify that your pod is bolusing or cancel the bolus. From 6e47d096a909a5fbcccb9c8b8ed3c3380940dbf3 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 10:13:18 -0500 Subject: [PATCH 2/6] Fix compilation error --- .../omnipod_dash/comm/OmnipodDashCommunicationManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java index 284d093cca..116d44ea6b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod_dash/comm/OmnipodDashCommunicationManager.java @@ -11,6 +11,7 @@ import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentHighFlashLogDump; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver; @@ -116,4 +117,9 @@ public class OmnipodDashCommunicationManager implements OmnipodCommunicationMana } + @Override + public PodInfoRecentHighFlashLogDump readPulseLog() { + return null; + } + } From 5cbb5c8baa040d158ebc4ff8c1885e49b0e6c9f3 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 12:54:59 -0500 Subject: [PATCH 3/6] Improve some Omnipod translations --- app/src/main/res/values/strings.xml | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4cf6716ace..06493f14d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1682,16 +1682,16 @@ An unexpected error occured. Please report! (type: %1$s). Communication failed: received invalid input parameters. Communication failed. - Communication failed: Message integrity verification failed. - Communication failed: received an invalid packet from the pod. - Communication failed: the pod is in a wrong state. - Communication failed: received an invalid response from the pod. - Communication failed: failed to decode message from the pod. + Communication failed: message integrity verification failed. + Communication failed: received an invalid packet from the Pod. + Communication failed: the Pod is in a wrong state. + Communication failed: received an invalid response from the Pod. + Communication failed: failed to decode message from the Pod. Communication failed: nonce resync failed. Communication failed: nonce out of sync. - Communication failed: not enough data received from the pod. - A pod fault (%1$03d %2$s) has been detected. Please deactivate your pod and start a new one. - Communication failed: the pod returned an error response. + Communication failed: not enough data received from the Pod. + A Pod fault (%1$03d %2$s) has been detected. Please deactivate your Pod and start a new one. + Communication failed: the Pod returned an error response. Pod Management @@ -1714,7 +1714,7 @@ Resume Delivery Unknown Entry - If you press "OK" Pod will be forcefully removed. Do this only if you can not communicate with Pod anymore. + If you press OK, the Pod state will be forcibly reset and you will not be able to communicate with the Pod anymore. Do this only if you can not communicate with the Pod anymore. If you can still communicate with the Pod, please use the Deactivate Pod option. Pod History not available at the moment. Omnipod @@ -1723,21 +1723,21 @@ Fill the Pod - \nFill new Pod with Insulin.\n\n\nAfter filling Pod, listen for 2 beeps, then press "Next".\n\n\nNote: Do not remove needle cap at this time. - Pair and Prime the Pod - We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If you decide to Cancel, you will have to discard the Pod. If there is an error you will get option to retry. + \nFill the new Pod with insulin.\n\nListen for two beeps from the Pod during the filling process. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press Next.\n\nNote: do not remove the Pod\'s needle cap at this time. + Priming + Trying to pair with and prime the new Pod.\n\nWhen all items are checked, you can press Next.\n\nNote: please keep the Pod very close to the RileyLink at this time. Attach the Pod - \nPrepare infusion site. Remove Pods needle cap.\n\nIf cannula sticks out press Cancel (Pod will need to be discarded).\n\nPress Next to insert cannula and begin Basal Delivery. - Fill Cannula and Start Basal delivery + \nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the pod to the infusion site.\n\nIf the cannula sticks out, please press Cancel and discard your Pod.\n\nPress Next to insert the cannula and begin basal delivery. + Inserting cannula Pod Info - Pod is now active.\n\nBasal has been programmed.\n\nCheck infusion site and cannula. If cannula seems incorrectly inserted, please replace the Pod. + \nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t. - Prepare for Pod Removal - \nPress Next to begin Pod removal process.\n\n\nThis will stop delivery of insulin and deactivate Pod. - Remove the Pod - We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If Pod removal fails you need to click on Cancel. + Deactivate Pod + \nPress Next to deactivate the Pod.\n\nNote: This will suspend all insulin delivery and deactivate the Pod. + Deactivating the Pod + Deactivating the Pod.\n\nWhen all items are checked, you can press Next.\n\nNote: If deactivating continuously fails, please press Cancel and use the Reset Pod option to forcibly reset the pod state. - Pod deactivated.\n\nRemove and discard the Pod.\n\nWhen you are ready, prepare the next Pod and start Init Pod action. + Pod deactivated.\n\nPlease remove the Pod from your body and discard it. Pair Pod Prime Pod From 6d377d7b6ab7918f636dd4e787e2b048d00265a2 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 13:31:40 -0500 Subject: [PATCH 4/6] Handle exceptions when retrieving pod pulse log --- .../plugins/pump/omnipod/driver/ui/OmnipodUITask.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index 60c3508f31..797c6c77a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -90,7 +90,14 @@ public class OmnipodUITask { break; case GetPodPulseLog: - returnDataObject = communicationManager.readPulseLog(); + try { + returnDataObject = communicationManager.readPulseLog(); + } catch(Exception ex) { + if(isLogEnabled()) { + LOG.warn("Failed to retrieve pulse log", ex); + } + returnDataObject = null; + } break; case GetPodStatus: From 10ab880e2835cbc377608d1f2f4f8db1264ae3e6 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 13:51:20 -0500 Subject: [PATCH 5/6] Retry Get pulse log command in case of failure --- .../pump/omnipod/driver/ui/OmnipodUITask.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index 797c6c77a0..a8f21d6787 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -90,13 +90,19 @@ public class OmnipodUITask { break; case GetPodPulseLog: - try { - returnDataObject = communicationManager.readPulseLog(); - } catch(Exception ex) { - if(isLogEnabled()) { - LOG.warn("Failed to retrieve pulse log", ex); + // This command is very error prone, so retry a few times if it fails + // Can take some time, but that's ok since this is a very specific feature for experts + // And will not be used by normal users + for(int i = 0; 3 > i; i++) { + try { + returnDataObject = communicationManager.readPulseLog(); + break; + } catch (Exception ex) { + if (isLogEnabled()) { + LOG.warn("Failed to retrieve pulse log", ex); + } + returnDataObject = null; } - returnDataObject = null; } break; From e8ca4259e1471e9cd175544c82ef7090c97c0799 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 14:27:18 -0500 Subject: [PATCH 6/6] Rename pulse log related stuff in UI --- .../androidaps/plugins/pump/omnipod/OmnipodFragment.kt | 3 +-- .../androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java | 5 +---- .../plugins/pump/omnipod/driver/OmnipodPumpStatus.java | 5 ++--- .../androidaps/plugins/pump/omnipod/util/OmnipodConst.java | 2 +- app/src/main/res/layout/omnipod_fragment.xml | 4 ++-- app/src/main/res/values/strings.xml | 6 ++++-- app/src/main/res/xml/pref_omnipod.xml | 4 ++-- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt index db02281763..5181e2a44f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt @@ -26,7 +26,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDevice import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus -import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil @@ -172,7 +171,7 @@ class OmnipodFragment : Fragment() { fun setVisibilityOfPodDebugButton() { - val isEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false) + val isEnabled = SP.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false) if (isEnabled) omnipod_pod_debug.visibility = View.VISIBLE diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index ca2bb590f3..dcd8b01d02 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -38,7 +38,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction; import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification; -import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.general.overview.notifications.Notification; import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; @@ -54,7 +53,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCustomActionT import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest; -import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus; import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager; @@ -63,7 +61,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodRefreshButtonState; import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService; -import info.nightscout.androidaps.plugins.pump.omnipod.util.LogReceiver; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin; @@ -186,7 +183,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump if ((event.isChanged(R.string.key_omnipod_beep_basal_enabled)) || (event.isChanged(R.string.key_omnipod_beep_bolus_enabled)) || (event.isChanged(R.string.key_omnipod_beep_tbr_enabled)) || - (event.isChanged(R.string.key_omnipod_pod_expert_debug_enabled)) || + (event.isChanged(R.string.key_omnipod_pod_debugging_options_enabled)) || (event.isChanged(R.string.key_omnipod_beep_smb_enabled))) refreshConfiguration(); }, FabricPrivacy::logException) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java index f6eb4ec51e..2fb6bd10c2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.pump.omnipod.driver; -import org.jetbrains.annotations.Nullable; import org.joda.time.LocalDateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +57,7 @@ public class OmnipodPumpStatus extends PumpStatus { public boolean beepBasalEnabled = true; public boolean beepSMBEnabled = true; public boolean beepTBREnabled = true; - public boolean podExpertDebugModeEnabled = false; + public boolean podDebuggingOptionsEnabled = false; public OmnipodPumpStatus(PumpDescription pumpDescription) { super(pumpDescription); @@ -106,7 +105,7 @@ public class OmnipodPumpStatus extends PumpStatus { this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true); this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true); this.beepTBREnabled = SP.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true); - this.podExpertDebugModeEnabled = SP.getBoolean(OmnipodConst.Prefs.PodExpertDebugModeEnabled, false); + this.podDebuggingOptionsEnabled = SP.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false); LOG.debug("Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.beepBasalEnabled, this.beepBolusEnabled, this.beepSMBEnabled, this.beepTBREnabled); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodConst.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodConst.java index 7d3f62ed20..367008b5e7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodConst.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodConst.java @@ -18,7 +18,7 @@ public class OmnipodConst { public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled; public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled; public static final int BeepTBREnabled = R.string.key_omnipod_beep_tbr_enabled; - public static final int PodExpertDebugModeEnabled = R.string.key_omnipod_pod_expert_debug_enabled; + public static final int PodDebuggingOptionsEnabled = R.string.key_omnipod_pod_debugging_options_enabled; } public class Statistics { diff --git a/app/src/main/res/layout/omnipod_fragment.xml b/app/src/main/res/layout/omnipod_fragment.xml index 03ab29d287..629d431e43 100644 --- a/app/src/main/res/layout/omnipod_fragment.xml +++ b/app/src/main/res/layout/omnipod_fragment.xml @@ -610,7 +610,7 @@ android:drawableTop="@drawable/icon_danarstats" android:paddingLeft="0dp" android:paddingRight="0dp" - android:text="RL Stats" /> + android:text="@string/omnipod_rl_stats" />