use delivery status for checking if there is a tempbasal to cancel
This commit is contained in:
parent
34103931f5
commit
3dc4781692
2 changed files with 4 additions and 4 deletions
|
@ -307,7 +307,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
return ret
|
||||
}
|
||||
|
||||
private fun observeNoActiveTempBasal(enforeNew: Boolean): Completable {
|
||||
private fun observeNoActiveTempBasal(enforceNew: Boolean): Completable {
|
||||
return Completable.defer {
|
||||
val expectedState = pumpSync.expectedPumpState()
|
||||
when {
|
||||
|
@ -315,7 +315,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
||||
Completable.complete()
|
||||
}
|
||||
!enforeNew ->
|
||||
!enforceNew ->
|
||||
Completable.error(
|
||||
IllegalStateException(
|
||||
"Temporary basal already active and enforeNew is not set."
|
||||
|
@ -335,7 +335,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
|
||||
private fun observeActiveTempBasal(): Completable {
|
||||
return Completable.defer {
|
||||
if (pumpSync.expectedPumpState().temporaryBasal != null)
|
||||
if (podStateManager.tempBasalActive)
|
||||
Completable.complete()
|
||||
else
|
||||
Completable.error(
|
||||
|
|
|
@ -148,7 +148,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
get() = podState.tempBasal
|
||||
|
||||
override val tempBasalActive: Boolean
|
||||
get() = tempBasal != null && tempBasal!!.startTime + tempBasal!!.durationInMinutes * 60 * 1000 > System.currentTimeMillis()
|
||||
get() = podState.deliveryStatus in arrayOf(DeliveryStatus.TEMP_BASAL_ACTIVE, DeliveryStatus.BOLUS_AND_TEMP_BASAL_ACTIVE)
|
||||
|
||||
override var basalProgram: BasalProgram?
|
||||
get() = podState.basalProgram
|
||||
|
|
Loading…
Reference in a new issue