From b1cc067c85b275ce4f3f6e5101a961d287a94fd4 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 8 Dec 2019 20:03:32 +0100 Subject: [PATCH 1/3] Update suspended state in PumpStatus --- .../pump/omnipod/driver/comm/AapsOmnipodManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 8aaae8e375..9240e972a5 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 @@ -23,6 +23,7 @@ import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.bus.RxBus; import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; +import info.nightscout.androidaps.plugins.pump.common.defs.PumpStatusType; import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService; import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager; import info.nightscout.androidaps.plugins.pump.omnipod.comm.SetupActionResult; @@ -114,13 +115,15 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface } } - // Update other info: last bolus, units remaining + // Update other info: last bolus, units remaining, suspended if (!Objects.equals(lastBolusTime, pumpStatus.lastBolusTime) // || !Objects.equals(lastBolusUnits, pumpStatus.lastBolusAmount) // - || !isReservoirStatusUpToDate(pumpStatus, podSessionState.getReservoirLevel())) { + || !isReservoirStatusUpToDate(pumpStatus, podSessionState.getReservoirLevel()) + || podSessionState.isSuspended() != pumpStatus.pumpStatusType.equals(PumpStatusType.Suspended)) { pumpStatus.lastBolusTime = lastBolusTime; pumpStatus.lastBolusAmount = lastBolusUnits; pumpStatus.reservoirRemainingUnits = podSessionState.getReservoirLevel() == null ? 75.0 : podSessionState.getReservoirLevel(); + pumpStatus.pumpStatusType = (podSessionState.hasFaultEvent() || podSessionState.isSuspended()) ? PumpStatusType.Suspended : PumpStatusType.Running; sendEvent(new EventOmnipodPumpValuesChanged()); } } From b46914a97b098a19db0eff372063925e8785b24b Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 8 Dec 2019 20:13:15 +0100 Subject: [PATCH 2/3] Update suspended status when podstate is null --- .../plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 9240e972a5..04cb5143a7 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 @@ -93,6 +93,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface pumpStatus.lastBolusTime = null; pumpStatus.lastBolusAmount = null; pumpStatus.reservoirRemainingUnits = 0.0; + pumpStatus.pumpStatusType = PumpStatusType.Suspended; sendEvent(new EventOmnipodAcknowledgeAlertsChanged()); sendEvent(new EventOmnipodPumpValuesChanged()); } else { @@ -119,7 +120,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface if (!Objects.equals(lastBolusTime, pumpStatus.lastBolusTime) // || !Objects.equals(lastBolusUnits, pumpStatus.lastBolusAmount) // || !isReservoirStatusUpToDate(pumpStatus, podSessionState.getReservoirLevel()) - || podSessionState.isSuspended() != pumpStatus.pumpStatusType.equals(PumpStatusType.Suspended)) { + || podSessionState.isSuspended() != PumpStatusType.Suspended.equals(pumpStatus.pumpStatusType)) { pumpStatus.lastBolusTime = lastBolusTime; pumpStatus.lastBolusAmount = lastBolusUnits; pumpStatus.reservoirRemainingUnits = podSessionState.getReservoirLevel() == null ? 75.0 : podSessionState.getReservoirLevel(); From 6a4765d99871c9396c4579f2370497f09d020afb Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 8 Dec 2019 21:02:39 +0100 Subject: [PATCH 3/3] Cache last bolus in AapsOmnipodManager --- .../plugins/pump/omnipod/driver/comm/AapsOmnipodManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 04cb5143a7..5c33771273 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 @@ -257,8 +257,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface double unitsDelivered = bolusDeliveryResult.getUnitsDelivered(); if (pumpStatus != null && !isSmb) { - pumpStatus.lastBolusTime = bolusStarted; - pumpStatus.lastBolusAmount = unitsDelivered; + lastBolusTime = pumpStatus.lastBolusTime = bolusStarted; + lastBolusUnits = pumpStatus.lastBolusAmount = unitsDelivered; } return new PumpEnactResult().success(true).enacted(true).bolusDelivered(unitsDelivered);