ignore enforeNew for now
This commit is contained in:
parent
3dc4781692
commit
b440003de4
2 changed files with 21 additions and 26 deletions
|
@ -272,7 +272,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
.filter { podEvent -> podEvent is PodEvent.CommandSent }
|
||||
.map { pumpSyncTempBasal(it, tbrType) }
|
||||
.ignoreElements(),
|
||||
pre = observeNoActiveTempBasal(enforceNew)
|
||||
pre = observeNoActiveTempBasal()
|
||||
).toPumpEnactResult()
|
||||
}
|
||||
|
||||
|
@ -307,21 +307,13 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
return ret
|
||||
}
|
||||
|
||||
private fun observeNoActiveTempBasal(enforceNew: Boolean): Completable {
|
||||
private fun observeNoActiveTempBasal(): Completable {
|
||||
return Completable.defer {
|
||||
val expectedState = pumpSync.expectedPumpState()
|
||||
when {
|
||||
expectedState.temporaryBasal == null -> {
|
||||
if (expectedState.temporaryBasal == null) {
|
||||
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
||||
Completable.complete()
|
||||
}
|
||||
!enforceNew ->
|
||||
Completable.error(
|
||||
IllegalStateException(
|
||||
"Temporary basal already active and enforeNew is not set."
|
||||
)
|
||||
)
|
||||
else -> {
|
||||
} else {
|
||||
// enforceNew == true
|
||||
aapsLogger.info(LTag.PUMP, "Canceling existing temp basal")
|
||||
executeSimpleProgrammingCommand(
|
||||
|
@ -331,7 +323,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeActiveTempBasal(): Completable {
|
||||
return Completable.defer {
|
||||
|
|
|
@ -240,9 +240,13 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
|
||||
if (sentRealtime < createdRealtime) { // command was not sent, clear it up
|
||||
podState.activeCommand = null
|
||||
source.onError(this.sendError
|
||||
?: java.lang.IllegalStateException("Could not send command and sendError is " +
|
||||
"missing") )
|
||||
source.onError(
|
||||
this.sendError
|
||||
?: java.lang.IllegalStateException(
|
||||
"Could not send command and sendError is " +
|
||||
"missing"
|
||||
)
|
||||
)
|
||||
} else if (createdRealtime >= lastStatusResponseReceived)
|
||||
// we did not receive a valid response yet
|
||||
source.onComplete()
|
||||
|
|
Loading…
Reference in a new issue