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 3262014a58..684e8f234f 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 @@ -179,9 +179,7 @@ public class OmnipodManager { logStartingCommandExecution("setBasalSchedule [basalSchedule=" + schedule + ", acknowledgementBeep=" + acknowledgementBeep + "]"); try { - // Never emit a beep for suspending delivery, so if the user has beeps enabled, - // they can verify that setting the basal schedule succeeded (not suspending the delivery) - cancelDelivery(EnumSet.allOf(DeliveryType.class), false); + cancelDelivery(EnumSet.allOf(DeliveryType.class), acknowledgementBeep); } catch (Exception ex) { logCommandExecutionFinished("setBasalSchedule"); throw ex; @@ -209,9 +207,7 @@ public class OmnipodManager { logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]"); try { - // Never emit a beep for cancelling temp basal, so if the user has beeps enabled, - // they can verify that setting the temp basal succeeded (and not cancelling it) - cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), false); + cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep); } catch (Exception ex) { logCommandExecutionFinished("setTemporaryBasal"); throw ex; @@ -241,7 +237,12 @@ public class OmnipodManager { logStartingCommandExecution("cancelDelivery [deliveryTypes=" + deliveryTypes + ", acknowledgementBeep=" + acknowledgementBeep + "]"); try { - executeAndVerify(() -> communicationService.executeAction(new CancelDeliveryAction(podState, deliveryTypes, acknowledgementBeep))); + executeAndVerify(() -> { + StatusResponse statusResponse = communicationService.executeAction(new CancelDeliveryAction(podState, deliveryTypes, acknowledgementBeep)); + if (isLoggingEnabled()) { + LOG.info("Status response after cancel delivery[types={}]: {}", deliveryTypes.toString(), statusResponse.toString()); + } + }); } finally { logCommandExecutionFinished("cancelDelivery"); } @@ -537,8 +538,11 @@ public class OmnipodManager { } try { logStartingCommandExecution("verifyCommand"); - communicationService.sendCommand(StatusResponse.class, podState, + StatusResponse statusResponse = communicationService.sendCommand(StatusResponse.class, podState, new CancelDeliveryCommand(podState.getCurrentNonce(), BeepType.NO_BEEP, DeliveryType.NONE), false); + if (isLoggingEnabled()) { + LOG.info("Status response after verifyCommand (cancelDelivery[types=DeliveryType.NONE]): {}", statusResponse.toString()); + } } catch (NonceOutOfSyncException ex) { if (isLoggingEnabled()) { LOG.info("Command resolved to FAILURE (CERTAIN_FAILURE)", ex); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java index 686fc0036b..91590272a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/CancelDeliveryAction.java @@ -39,7 +39,7 @@ public class CancelDeliveryAction implements OmnipodAction { List messageBlocks = new ArrayList<>(); messageBlocks.add(new CancelDeliveryCommand(podState.getCurrentNonce(), - acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BIP_BIP : BeepType.NO_BEEP, deliveryTypes)); + acknowledgementBeep && deliveryTypes.size() == 1 ? BeepType.BEEP : BeepType.NO_BEEP, deliveryTypes)); if (acknowledgementBeep && deliveryTypes.size() > 1) { // Workaround for strange beep behaviour when cancelling multiple delivery types at the same time @@ -49,7 +49,7 @@ public class CancelDeliveryAction implements OmnipodAction { // we should keep the beep config for delivery types that we're not cancelling. // We currently have no use case that though, // as we either cancel 1 type or all types, - messageBlocks.add(new BeepConfigCommand(BeepConfigType.BIP_BIP)); + messageBlocks.add(new BeepConfigCommand(BeepConfigType.BEEP)); } return communicationService.exchangeMessages(StatusResponse.class, podState, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java index 24dc6cbcb0..e88fafdb6c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/DeactivatePodAction.java @@ -8,6 +8,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.Sta import info.nightscout.androidaps.plugins.pump.omnipod.defs.DeliveryType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.exception.ActionInitializationException; +import info.nightscout.androidaps.plugins.pump.omnipod.exception.PodFaultException; public class DeactivatePodAction implements OmnipodAction { private final PodSessionState podState; @@ -24,8 +25,12 @@ public class DeactivatePodAction implements OmnipodAction { @Override public StatusResponse execute(OmnipodCommunicationService communicationService) { if (!podState.isSuspended() && !podState.hasFaultEvent()) { - communicationService.executeAction(new CancelDeliveryAction(podState, - EnumSet.allOf(DeliveryType.class), acknowledgementBeep)); + try { + communicationService.executeAction(new CancelDeliveryAction(podState, + EnumSet.allOf(DeliveryType.class), acknowledgementBeep)); + } catch(PodFaultException ex) { + // Ignore + } } return communicationService.sendCommand(StatusResponse.class, podState, new DeactivatePodCommand(podState.getCurrentNonce()));