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
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeNoActiveTempBasal(enforeNew: Boolean): Completable {
|
private fun observeNoActiveTempBasal(enforceNew: Boolean): Completable {
|
||||||
return Completable.defer {
|
return Completable.defer {
|
||||||
val expectedState = pumpSync.expectedPumpState()
|
val expectedState = pumpSync.expectedPumpState()
|
||||||
when {
|
when {
|
||||||
|
@ -315,7 +315,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
||||||
Completable.complete()
|
Completable.complete()
|
||||||
}
|
}
|
||||||
!enforeNew ->
|
!enforceNew ->
|
||||||
Completable.error(
|
Completable.error(
|
||||||
IllegalStateException(
|
IllegalStateException(
|
||||||
"Temporary basal already active and enforeNew is not set."
|
"Temporary basal already active and enforeNew is not set."
|
||||||
|
@ -335,7 +335,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
private fun observeActiveTempBasal(): Completable {
|
private fun observeActiveTempBasal(): Completable {
|
||||||
return Completable.defer {
|
return Completable.defer {
|
||||||
if (pumpSync.expectedPumpState().temporaryBasal != null)
|
if (podStateManager.tempBasalActive)
|
||||||
Completable.complete()
|
Completable.complete()
|
||||||
else
|
else
|
||||||
Completable.error(
|
Completable.error(
|
||||||
|
|
|
@ -148,7 +148,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
||||||
get() = podState.tempBasal
|
get() = podState.tempBasal
|
||||||
|
|
||||||
override val tempBasalActive: Boolean
|
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?
|
override var basalProgram: BasalProgram?
|
||||||
get() = podState.basalProgram
|
get() = podState.basalProgram
|
||||||
|
|
Loading…
Reference in a new issue