From e867b1397db6ac8e4742afb67acaf54886fe3688 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Mon, 31 May 2021 22:15:39 +0200 Subject: [PATCH] remove maybeMarkActiveCommandFailed. this logic was moved in "updateActiveCommand" --- .../pod/state/OmnipodDashPodStateManager.kt | 1 - .../state/OmnipodDashPodStateManagerImpl.kt | 18 ++++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt index a1030d61eb..1396f97443 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManager.kt @@ -70,7 +70,6 @@ interface OmnipodDashPodStateManager { fun createActiveCommand(historyId: String): Single fun updateActiveCommand(): Maybe fun observeNoActiveCommand(): Observable - fun maybeMarkActiveCommandFailed() data class ActiveCommand( val sequence: Short, diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt index f00b0d1dae..38819f0a0f 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt @@ -228,16 +228,6 @@ class OmnipodDashPodStateManagerImpl @Inject constructor( } } - @Synchronized - override fun maybeMarkActiveCommandFailed() { - podState.activeCommand?.run { - if (sentRealtime < createdRealtime) { - // command was not sent - podState.activeCommand = null - } - } - } - @Synchronized override fun updateActiveCommand() = Maybe.create { source -> podState.activeCommand?.run { @@ -246,8 +236,12 @@ class OmnipodDashPodStateManagerImpl @Inject constructor( "lastResponse=$lastStatusResponseReceived " + "$sequenceNumberOfLastProgrammingCommand $historyId" ) - if (createdRealtime >= lastStatusResponseReceived) - // we did not receive a valid response yet + if (sentRealtime < createdRealtime) { + // command was not sent, clear it up + podState.activeCommand = null + source.onComplete() + } else if (createdRealtime >= lastStatusResponseReceived) + // we did not receive a valid response yet source.onComplete() else { podState.activeCommand = null